Please note javascript is required for full website functionality.

Blog

A to Z of Excel Functions: The HEX2DEC Function

30 March 2020

Welcome back to our regular A to Z of Excel Functions blog. Today we look at the HEX2DEC function.

The HEX2DEC function

This function converts a hexadecimal number (base 16) to decimal (base 10).

The HEX2DEC function employs the following syntax to operate:

HEX2DEC(number)


The HEX2DEC function has the following argument:

  • number: this is required and represents the hexadecimal integer you wish to convert.  The number cannot contain more than 10 characters (40 bits).  The most significant bit of number is the sign bit (40th bit from the right).  The remaining 39 bits are magnitude bits.  Negative numbers are represented using two's-complement notation.

Two's complement is a mathematical operation on binary numbers, as well as a binary signed number representation based on this operation.  The two's complement of an N-bit number is defined as the complement with respect to 2N; in other words, it is the result of subtracting the number from 2N.  This is also equivalent to taking the ones' complement and then adding one, since the sum of a number and its ones' complement is all 1 bits.  The two's complement of a number behaves like the negative of the original number in most arithmetic, and positive and negative numbers can coexist in a natural way.

It should be further noted that:

  • if number is not a valid hexadecimal number, HEX2DEC returns the #NUM! error value.

Please see my example below: 

We’ll continue our A to Z of Excel Functions soon. Keep checking back – there’s a new blog post every business day.

A full page of the function articles can be found here.

Newsletter