top of page

How to use the HEX2DEC Function

How to use the HEX2DEC Function in Excel

The HEX2DEC function converts decimal numbers into hexadecimal numbers.

Contents:


Syntax

= HEX2DEC(number)

number - The hexadecimal number you wish to convert to a decimal number


Explanation

The HEX2DEC function is part of the "Engineering" group of functions within Excel.


This function takes in hexadecimal numbers and converts them into decimal form.


The hexadecimal number can be up to 10 characters, or bits, in length. If the length exceeds this, a #NUM error will be returned.


This means the largest number than can be represented is "1F74876E7FF" in hexadecimal or 99999999999 in decimal form.


What is a Hexadecimal Number

The hexadecimal number system uses base 16, and uses the standard 0-9 digits, but also includes the letters A-F to represent higher numbers.


Hexadecimal Number Table

This table shows the hexadecimal version of the standard decimal numbers that we are used to working with.


Because hexadecimals use a base 16, this means that the as the numbers of digits increase, their place value, increases by a power of 16. The first being 16^0 = 1, next being 16^1 = 16, 16^2 = 256, and so on.


If we look at it visually, it would look like this:

understanding how binary numbers are calculated

In this example, the hexadecimal number 2B3 is calculated by multiplying the first value , "3", by 1, the second value "B" which represents 11 by 16, and finally the third value "2" by 256, and then adding them all together to get 691.


What is a Decimal Number

A decimal number is a number expressed in the base-10 numeral system, also known as the decimal system, the most commonly used system worldwide.


Each digit is based on its position, or place value, which increases by a power of 10 as you move from right to left.


understanding how decimal numbers are calculated

In this example, the number 102 is calculated by multiplying the ones place, "2", by 1, then the tens place by "0", and finally the hundreds place by "1", and adding the results together.


Examples

How to Convert Hexadecimal Number to Decimal

Let's say we have table of hexadecimal numbers, and need to convert them into decimal.

excel convert hexadecimal number to decimal with formula

The formula to convert from hexadecimal to decimal would be:

= HEX2DEC(hexadecimal_number)

If we plug this formula into the table, the formula returns the correct decimal number.

convert hexadecimal numbers to decimal numbers in excel

Using the HEX2DEC function in the right column lets us easily convert multiple decimal numbers at once.

excel convert hexadecimal string to decimal

bottom of page