[Table of Contents] [docx version]
SpreadsheetML Reference Material - Table of Contents
DEC2BIN ( number [ , num-bin-digits ] )
Description: Makes the binary equivalent of number, with the result having num-bin-digits digits.
Arguments:
Name |
Type |
Description |
number |
number |
The decimal number that is to be converted to a binary string. |
num-bin-digits |
number |
The number of digits in the result, with leading zeros added as necessary. However, if number is negative, num-bin-digits is ignored and the result has 10 digits. If omitted, the minimum number of digits is used in the result. num-bin-digits is truncated to an integer. |
Return Type and Value: text – The binary equivalent of number using twos-complement representation with the left-most bit (10th bit from the right) representing the sign bit.
However, if
• number is outside the range -512 (1000000000 binary) to 511 (0111111111 binary), inclusive, #NUM! is returned.
• number needs more digits that num-bin-digits, #NUM! is returned.
• num-bin-digits ≤ 0 or > 10, #NUM! is returned.
[Example:
DEC2BIN(23) results in 10111
DEC2BIN(-256) results in 1100000000
DEC2BIN(18,7) results in 0010010
end example]