Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like a format a cell in Microsoft Excel 2007 in hexadecimal but am not finding how to do this.

Is there a built-in way to change the base from 10 to 16 for a cell?

share|improve this question
up vote 13 down vote accepted

If you want to format a cell so that you can type in a decimal number and automatically have it displayed as a hexadecimal number, then that's not possible. You can either format the cell as text and enter hexadecimal numbers directly (but note that Excel cannot use those for calculations), or use the DEC2HEX() and HEX2DEC() functions to convert between base 10 and base 16.

share|improve this answer
For reference, there is also DEC2BIN() which converts to binary. For fixed width binary, use something like =TEXT(DEC2BIN(A1), "0000") – Tor Klingberg Jul 28 '15 at 14:11
On a German localized Excel 2013, DEC2HEX and HEX2DEC result in the error message #NAME?. With the Office Help, I could find out that the functions are called DEZINHEX and HEXINDEZ, resp. – Bernhard Hiller Jul 18 at 9:41

If cell to be converted is A1 use =DEC2HEX(A1).

share|improve this answer
You may want to add a leading "0x" to your hex value. Use ="0x"&DEC2HEX(A1,4) to get a result that looks like like 0x1AF2. – User5910 Jun 30 at 22:47

If you need to perform mathematical operations on numbers converted to hex, first convert them to decimal, perform the operation, then convert back to hex.

For example, if cell A1 has a hex number, such as would be created from this formula:


which would be displayed as 11, and cell A2 has formula:


which would be displayed as A5, and you want to add them together, then this formula would get the desired result:


which would be displayed as B6

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .