Features of !SEMTools
↑ Navigate Excel tasks and !SEMTools add-in features ↑

HEX2DEC

, creator of !SEMToolsUpdated 2 min readTopics: Excel functions, Numbers and calculations
HEX2DEC function examples
Examples of using the HEX2DEC function and the returned result
Function CategoryEngineering
VolatilityNon-volatile
Related FunctionsDEC2HEX, BIN2DEC, DEC2BIN

What does the HEX2DEC function do?

This function converts a hexadecimal number to decimal.

HEX2DEC function syntax

=HEX2DEC(hexadecimal_number)
Hex to decimal
B3=HEX2DEC(A3)
AB
1HexHEX2DEC
2A10=HEX2DEC(A2)
3FF255=HEX2DEC(A3)
41F4500=HEX2DEC(A4)
57FFFFFFFFF549755813887=HEX2DEC(A5)
6FFFFFFFFFF-1=HEX2DEC(A6)
7G1#NUM!=HEX2DEC(A7)

Up to 10 hex characters (40 bits). The highest bit is the sign: FFFFFFFFFF is −1 in two’s complement. Letters can be upper or lower case; anything other than 0–9 and A–F returns #NUM!.

HEX2DEC formula example

The following table was used to calculate the sum of two hexadecimal numbers

Adding two hex numbers
C2=HEX2DEC(A2)+HEX2DEC(B2)
ABCD
1Hex 1Hex 2Sum (decimal)Sum (hex)
21AFF281=HEX2DEC(A2)+HEX2DEC(B2)119=DEC2HEX(C2)
37D0302048=HEX2DEC(A3)+HEX2DEC(B3)800=DEC2HEX(C3)
4FFFF165536=HEX2DEC(A4)+HEX2DEC(B4)10000=DEC2HEX(C4)

Excel can’t add hex text directly, so both numbers are converted to decimal, added, and DEC2HEX turns the sum back into hex.

Other Engineering Functions

BIN2DEC, DELTA, DEC2BIN, DEC2HEX, GESTEP, CONVERT

If hexadecimal codes have a consistent “0x” prefix, remove it before using HEX2DEC. !SEMTools can remove the first two characters throughout the selected range. Apply this only to records that actually have that prefix.

Like the article? Help its author! Buy !SEMTools, it has lots of useful instruments to process text data.