DEC2BIN function

DEC2BIN(Number, DigitCount?) DEC2BIN(Number; DigitCount?)

Number

Number or { Number }

A decimal number.

DigitCount

Number or { Number } (optional)

The number of digits to return. If omitted, the minimum number of digits necessary to accurately represent the number is used.

Returns

Text or { Text }

A binary number.

Converts a decimal number to a binary number. Also consider using the more general function BASE. Perform the reverse conversion using BIN2DEC.

Examples

DEC2BIN(5)DEC2BIN(5)

Returns "101".

DEC2BIN(5, 4)DEC2BIN(5; 4)

Returns "0101".

DEC2BIN(123)DEC2BIN(123)

Returns "1111011".

BASE(123, 2)BASE(123; 2)

Returns "1111011".

DEC2BIN({ 5, 123 })DEC2BIN({ 5; 123 })

Returns the array { "101", "1111011" }{ "101"; "1111011" }.