Related Function:

The DEC2BIN function accepts converts a decimal number into a binary number.

Syntax

=DEC2BIN(number,[places])

Note: Hexadecimal (base 16), decimal (base 10), octal (base 8), and binary (base 2) are the most commonly used numeral systems in engineering and computing. Therefore, Excel has provided functions to convert numeric values to and from each of these systems.

Arguments

Argument Description
number The decimal integer you want to convert

  If number is negative, valid place values are ignored and DEC2BIN returns a 10-character (10-bit) binary number
  The most significant bit of number is the sign bit
  The remaining 9 bits are magnitude bits
[places] Optional. Defines the number of characters to use

  If [places] is omitted, DEC2BIN uses the minimum number of characters necessary
  [places] is useful for padding the return value with leading 0s (zeros)

Examples

  A B C
1 Formula Result Notes
2 =DEC2BIN(9,4) 1001 Converts decimal 9 to binary with 4 characters
3 =DEC2BIN(-100) 1110011100 Converts decimal -100 to binary
4 =DEC2BIN(2,10) 0000000010 Converts decimal 2 to binary with 10 characters

Common Function Error(s)

Problem What went wrong
#VALUE! Occurs if either:

  the supplied number argument is not numeric
  the supplied [places] argument is not numeric
#NUM! Occurs if either:

  the supplied [places] argument ≤ 0
  the result of DEC2BIN requires more than the number of [places] characters specified
  the number argument < -512 or if number argument > 511
#NAME? Occurs when Analysis ToolPak add-in is not enabled

The Binary (Base 2) Numeral System uses the digits 0 & 1.

The following table shows the first 8 binary values, along with the equivalent decimal values:

Binary 1 10 11 100 101 110 111 1000
Decimal 1 2 3 4 5 6 7 8

For further information on the binary numeral system, see the Wikipedia Binary Page