Converting Between Number Systems
Problem
You need to convert numbers between number systems, for example, from hexadecimal to decimal.
Solution
Use Excel's number system conversion functions such as HEX2DEC and DEC2HEX.
Discussion
When debugging software, I use the heck out of hexadecimal to decimal (and vice versa) conversions. Excel makes such conversions easy with its HEX2DEC and DEC2HEX functions.
The syntax for HEX2DEC is =HEX2DEC(n), where n is the hexadecimal to be converted. For example, the formula =HEX2DEC("1F0CC3") returns the decimal value 2,034,883.
Conversions from decimal to hexadecimal use the syntax DEC2HEX(n, digits), where n is the hexadecimal to be converted and digits is the number of characters to use for the resulting hexadecimal number. For example, the formula =DEC2HEX(64000,8) returns the hexadecimal value 0000FA00, whereas =DEC2HEX(64000,4) returns FA00.
See Also
Excel also supports conversions to and from the binary and octal systems. For example, OCT2HEX converts a number from octal to hexadecimal and DEC2BIN converts a decimal number to binary. Check out the Excel help topic "Engineering Functions" for more information on these other number system conversion functions.