DEC2HEX (decimal number to hexadecimal number)

<< Click to Display Table of Contents >>

DEC2HEX (decimal number to hexadecimal number)

Syntax:

DEC2HEX(Number [, Digits])

Description:

Converts the given decimal number (base 10) to a hexadecimal number (base 16).

Note: Please note that the result of this function is a text string – not a number.

Number is the number to be converted.

The permissible value range for Number is:

-(2^31) ≤ Number ≤ (2^31)-1

That is equivalent to:

-2,147,483,648 ≤ Number ≤ 2,147,483,647

The optional argument Digits lets you specify the number of places to be displayed. If omitted, PlanMaker determines the number of required places automatically.

Digits must be greater than zero. Digits should be an integer. Digits to the right of the decimal point are ignored.

If Digits is smaller than the minimum number of places required to display the number, the function returns a #NUM error value.

If Number is negative, the result is represented in 32-bit two's complement; the Digits argument is ignored in this case (see last example).

Example:

DEC2HEX(42) returns 2A

DEC2HEX(42, 8) returns 0000002A

DEC2HEX(42, 1) returns the error value #NUM! because the number 42 cannot be represented with fewer than 2 hexadecimal digits

DEC2HEX(-42) returns FFFFFFD6

See also:

HEX2DEC, DEC2BIN, DEC2OCT, BASE