Features of !SEMTools

DEC2BIN

DEC2BIN function in Excel - decimal to binary conversion examples
Examples of using the DEC2BIN function
Function categoryEngineering functions
VolatilityNon-volatile
Similar functionsBIN2DEC, DEC2HEX, HEX2DEC

What does this function do?

This function converts a decimal number to its binary equivalent.

It can only work with decimal numbers from -512 to 511.

The result can be padded with leading zeros using the second parameter.

Syntax

=DEC2BIN(decimal_number, [places])

Places – optional parameter. Ignored for negative numbers (they always have 10 digits).

  • decimal_number — required. The decimal integer you want to convert to binary
  • places — optional. The number of characters to use. If omitted, uses the minimum number necessary

Usage examples

Convert decimal 10 to binary:

=DEC2BIN(10)

Result: “1010”

Convert decimal 5 to binary with 8 characters:

=DEC2BIN(5, 8)

Result: “00000101”

Convert negative decimal number:

=DEC2BIN(-10)

Result: “1111111111110110”

Features

  • Negative numbers are represented using two’s complement notation with 10 bits
  • The places parameter is ignored for negative numbers
  • If places is too small, returns the #NUM! error
  • If decimal_number is less than -512 or greater than 511, returns the #NUM! error
  • If decimal_number is nonnumeric, returns the #VALUE! error
  • If places is nonnumeric, returns the #VALUE! error
  • If places is not an integer, it is truncated
  • If places is negative, returns the #NUM! error

Other Engineering functions in Excel

BIN2DEC, DELTA, DEC2HEX, GESTEP, CONVERT, HEX2DEC, DEC2OCT, OCT2DEC, BIN2HEX, HEX2BIN

Like the article? Help its author! Buy !SEMTools, it has lots of useful instruments to process text data.

This post is also available in RU.