Engineering - HEX2BIN Function



Description

The HEX2BIN function converts a hexadecimal number to binary.

Syntax

HEX2BIN (number, [places])

Arguments

Argument Description Required/ Optional
number

The hexadecimal number you want to convert.

Number cannot contain more than 10 characters (40 bits). The most significant bit of number is the sign bit (40th bit from the right). The remaining 39 bits are magnitude bits.

Negative numbers are represented using two's-complement notation.

Required
places

The number of characters to use.

If places is omitted, HEX2BIN uses the minimum number of characters necessary.

Places is useful for padding the return value with leading 0s (zeros).

Optional

Notes

  • The Hexadecimal (Base 16) Numeral System uses the digits 0-9 and the characters A-F

  • The following table shows the first 32 hexadecimal values, along with the equivalent decimal values −

HEX2BIN Hexadecimal Values
  • As hexadecimals use the numbers 0-9 and the characters A-F, they should be enclosed in quotation marks when they are supplied to an Excel function. For example, the hexadecimal 11A should be input as "11A"

  • The Binary (Base 2) Numeral System uses the digits 0 & 1.

  • The following table shows the first 8 binary values, along with the equivalent decimal values −

HEX2BIN Binary Values
  • If number is negative, HEX2BIN ignores places and returns a 10-character binary number.

  • If number is negative, it cannot be less than FFFFFFFE00

  • If number is positive, it cannot be greater than 1FF.

  • If number is not a valid hexadecimal number, HEX2BIN returns the #NUM! error value.

  • If HEX2BIN requires more than places characters, it returns the #NUM! error value.

  • If places is not an integer, it is truncated.

  • If places is nonnumeric, HEX2BIN returns the #VALUE! error value.

  • If places is negative, HEX2BIN returns the #NUM! error value.

Applicability

Excel 2007, Excel 2010, Excel 2013, Excel 2016

Example

HEX2BIN Function
advanced_excel_engineering_functions.htm
Advertisements