How to use HEX2BIN function in Excel?

The `HEX2BIN` function in Excel is used to convert a hexadecimal number to its binary equivalent. Here’s how you can use this function:

Syntax

HEX2BIN(number, [places])
  • number: This is the hexadecimal number you want to convert. It must be a valid hexadecimal number, which can be a number between 1 and 10 characters long (you can include spaces, but they will be treated as zeros), using the characters 0-9 and A-F.
  • places (optional): This specifies the number of characters to use for the result. If you omit this argument, the function uses the minimum number of characters necessary. If you provide a value, it pads the result with leading zeros as necessary, but will return a `#NUM!` error if `places` is less than the number of characters required for the binary result.

Example

Suppose you want to convert a hexadecimal number `A3` to a binary number:

  • Basic Conversion:
    • Formula: `=HEX2BIN(“A3”)`
    • Result: `10100011`
  • With Places:
    • Formula: `=HEX2BIN(“A3”, 10)`
    • Result: `0010100011`

Important Points

  • If the `number` is not a valid hexadecimal number, Excel will return a `#NUM!` error.
  • If the `number` provided is negative, ensure it is given in the two’s complement binary representation, and the output will also be in two’s complement.
  • The result of the conversion truncates digits that do not fit into the specified `places` argument (if exceeded), so choosing places smaller than necessary will result in a `#NUM!` error.

By following these guidelines, you should be able to effectively use the HEX2BIN function to perform hexadecimal to binary conversions in Excel.

Unlock Your Potential

Excel

Basic - Advanced

Access

Access Basic - Advanced

Power BI

Power BI Basic - Advanced

Help us grow the project