DEC2BIN

  • Updated

Converts a decimal number to binary.

Sample Usage

DEC2BIN(5)
DEC2BIN(C5)

Syntax

DEC2BIN(number, [places])

  • number - The decimal number to be converted.
  • places - [OPTIONAL] The number of places in the output.

Examples

DEC2BIN(5) returns a value of 101.
DEC2BIN(5,5) returns a value of 00101.
DEC2BIN(C5) converts the decimal number contained in C5 to binary.

Notes

  • If number is negative, the value of places is ignored and DEC2BIN returns a 10-character binary number in which the most significant bit is the sign bit. The remaining 9 bits are magnitude bits. 
  • If number < -512 or if number > 511, DEC2BIN returns the #NUM! error value.
  • If number is non-numeric, DEC2BIN returns the #VALUE! error value.
  • If places is not an integer, it is truncated.
  • If places is non-numeric, DEC2BIN returns the #VALUE! error value.
  • If places is zero or negative, DEC2BIN returns the #NUM! error value.
  • If the number of digits required is greater than the specified places, the #NUM! error is returned.