DEC2HEX

Syntax:

DEC2HEX ( number [ , num-hex-digits ] )

Description: Makes the hexadecimal equivalent of number, with the result having num-hex-digits digits.

Arguments:

Name

Type

Description

number

number

The decimal number that is to be converted to a hexadecimal string.

num-bin-digits

number

num-hex-digits is 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 hexadecimal equivalent of number using twos-complement representation with the left-most bit (40th bit from the right) representing the sign bit.

However, if

  • number is outside the range -549,755,813,888 (8000000000 hex) to 549,755,813,887 (7FFFFFFFFF hex), 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: