The Excel Hex2Dec function converts a hexadecimal (a base-16 number) into a decimal number.
Syntax: =HEX2DEC (number)
The HEX2DEC function syntax has the following arguments:
- Number : Required. 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. The remaining 39 bits are magnitude bits. Negative numbers are represented using two’s-complement notation.
Example: Let’s look at some Excel HEX2DEC function examples and explore how to use the HEX2DEC function as a worksheet function in Microsoft Excel:
Based on the Excel spreadsheet above, the following HEX2DEC examples would return:
- The number argument can have up to 10 characters (40 bits). The sign bit is the most significant bit of the number. The other 39 bits are used as magnitude bits. Excel represents negative numbers using two’s-complement notation.
- The HEX2DEC function returns a #NUM! error if the number is not a hexadecimal number.
- The function returns a #NUM! error if the number resembles >=3^23.