HEX2DEC function
The HEX2DEC function in Excel is used to convert a hexadecimal (base 16) number into its decimal (base 10) equivalent.
Syntax
HEX2DEC(number)
Parameters
number: The hexadecimal number that you want to convert to decimal. This should be a valid hexadecimal number, which can include digits from0-9andA-F, whereA= 10,B= 11,C= 12,D= 13,E= 14, andF= 15 in decimal.
How It Works
The HEX2DEC function takes a hexadecimal number (base 16) and converts it to a decimal number (base 10). It interprets the hexadecimal digits and calculates the equivalent decimal number by using powers of 16.
For example, the hexadecimal number 1A3 is calculated as:
Where A equals 10 in decimal.
Examples
- Basic Conversion: To convert the hexadecimal number
1A3to decimal:=HEX2DEC("1A3")The result will be 419 in decimal.
- Hexadecimal with Lowercase Letters: Excel handles both uppercase and lowercase hexadecimal letters. To convert
a3(lowercase) to decimal:=HEX2DEC("a3")The result will be 163 in decimal.
- Negative Hexadecimal Number: The HEX2DEC function can also handle negative hexadecimal numbers. To convert
-1F(which is-31in decimal):=HEX2DEC("-1F")The result will be -31 in decimal.
- Using Cell Reference: If cell
A1contains the hexadecimal number2F4, you can convert it to decimal:=HEX2DEC(A1)If
A1contains2F4, the result will be 756 in decimal.
Important Notes
- The HEX2DEC function supports both positive and negative hexadecimal numbers.
- Hexadecimal numbers can be entered as strings in the form of text (e.g.,
"1A3") or by referencing a cell containing the hexadecimal number. - If an invalid hexadecimal number (one that contains characters outside
0-9andA-F) is provided, Excel will return a #NUM! error. - The result is always a decimal number (base 10).
Summary
The HEX2DEC function in Excel converts hexadecimal (base 16) numbers into their decimal (base 10) equivalents. It can handle both positive and negative hexadecimal values, and is useful for converting between numeral systems, especially in fields such as computing and digital electronics.