Formualizer Docs

BIN2DEC

Converts a binary text value to decimal.

Supports up to 10 binary digits, including two's-complement negative values.

The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.

Syntax

=BIN2DEC(number)

Arguments

ArgumentTypeRequiredDefault
numberanyRequired—

Remarks

  • Input is coerced to text and must contain only 0 and 1.
  • 10-digit values starting with 1 are interpreted as signed two's-complement numbers.

Error cases

  • Returns #NUM! for invalid characters or inputs longer than 10 digits.

Examples

Convert a binary string into a decimal number.

Formula =BIN2DEC("1010")

Expected result 10

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Read the signed value represented by ten set bits.

Formula =BIN2DEC("1111111111")

Expected result -1

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Convert the all-zero value.

Formula =BIN2DEC("0")

Expected result 0

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

The digit 2 is outside base two.

Formula =BIN2DEC("102")

Expected result #NUM!

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Convert an unsigned binary value

Formula =BIN2DEC("101010")

Expected result 42

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

FAQ

How does BIN2DEC handle 10-bit values starting with 1?

They are interpreted as signed two's-complement values, so 1111111111 becomes -1.

Implementation

Engine source

On this page