BIN2HEX (binary number to hexadecimal number)

<< Click to Display Table of Contents >>

BIN2HEX (binary number to hexadecimal number)

Syntax:

BIN2HEX(Number [, Digits])

Description:

This converts the given binary number (base 2) to a hexadecimal number (base 16).

Number is the number to be converted.

Negative numbers must be represented in the 32-bit two's complement (see last example).

Number must not contain more than 32 places, thus the permissible value range is:

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

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

Digits must be greater than zero. Digits should be an integer. If this is not the case, PlanMaker automatically truncates the decimal places.

If Digits are less 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.

Example:

BIN2HEX("101010") returns 2A

BIN2HEX("00101010") also returns 2A

BIN2HEX("101010", 1) returns the #NUM! error value, as this number can only be represented with at least 2 digits

BIN2HEX("11111111111111111111111111010110") returns FFFFFFD6 (negative value)

See also:

HEX2BIN, BIN2DEC, BIN2OCT