[Table of Contents] [docx version]
SpreadsheetML Reference Material - Table of Contents
BIN2HEX ( number [ , num-hex-digits ] )
Description: Makes the uppercase hexadecimal equivalent of number, with the result having num-hex-digits digits.
Arguments:
Name |
Type |
Description |
number |
number |
A 10-digit binary number that is to be converted to a hexadecimal string. If number has less than 10 digits, leading zero digits are implied until it has exactly 10 digits. The 10 digits use twos-complement representation with the left-most bit (10th bit from the right) representing the sign bit. |
num-hex-digits |
number |
The number of digits in the result, with leading zeros added as necessary. However, if number is negative, num-hex-digits is ignored and the result has 10 digits. If num-hex-digits is omitted, the minimum number of digits is used in the result. num-hex-digits is truncated to an integer. |
Return Type and Value: text – The uppercase hexadecimal equivalent of number.
However, if
• number contains one or more non-binary digits, #NUM! is returned.
• number contains more than 10 binary digits; that is, number is outside the range 1000000000 (200 hex, -512 decimal) to 0111111111 (1FF hex, 511 decimal), inclusive, #NUM! is returned.
• number needs more digits that num-hex-digits, #NUM! is returned.
• num-hex-digits ≤ 0 or > 10, #NUM! is returned.
[Example:
BIN2HEX(1) results in 1
BIN2HEX(1,4) results in 0001
BIN2HEX(111111) results in 3F
BIN2HEX(1111000000) results in FFFFFFFFC0
BIN2HEX(1000000000,3) results in FFFFFFFE00
end example]