DEC2BIN(number [,places])

Returns the number converted from decimal to binary.

numberThe decimal integer you want to convert.
places(Optional) The number of characters to use.

Remarks

* If any of the arguments are not numeric, then #VALUE! is returned.
* If "number" < -512, then #NUM! is returned.
* If "number" > 511, then #NUM! is returned.
* If "number" < 0, then "places" is ignored and a 10-character (10-bit) binary number in which the most significant bit is the sign bit is returned. The remaining 9 bits are magnitude bits.
* If "number" < 0, then two's-complement notation is used to represent the number.
* If "places" is less than the number of characters needed, then #NUM! is returned.
* If "places" is not an integer, it is truncated.
* If "places" < 0, then #NUM! is returned.
* If "places" is left blank, then the minimum number of characters necessary.
* The "places" is useful for padding the return value with leading 0s (zeros).
* You can use the DEC2HEX function to return a number converted from decimal to binary.
* You can use the DEC2OCT function to return a number converted from decimal to octal.
* You can use the BIN2DEC function to return a number converted from binary to decimal.
* In Excel 2003 this function was only available when you had the Analysis ToolPak add-in loaded.
* For the Microsoft documentation refer to support.office.com

 A
1=DEC2BIN(9,4) = 1001
2=DEC2BIN(-17) = 1111101111
3=DEC2BIN(-100) = 1110011100
4=DEC2BIN(9,6) = 001001
5=DEC2BIN(9,2) = #NUM!
6=DEC2BIN("some text",8) = #VALUE!
7=DEC2BIN(9,"some text") = #VALUE!


© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited Top