# Microsoft Office Application Help - Excel Help forum > Excel General >  >  Entering HEX into Excel

## Gougie

I was assuming it was obivous how into enter hexidecimal numbers into Excel but I think I've failed.

I've tried:

  0x
  &
  HEX(...)

Am I missing something obivous? Is there a hex option?

Thanks,

----------


## daddylonglegs

Well, I think entering them should be easy enough.....do you mean that you want excel to interpret them as HEX numbers? What do you want to do with them, how high do they go?

----------


## shg

Excel doesn't handle hex numbers. If can convert between decimal numbers and hex strings, but the hex strings are just that: strings. You can't, for example, format a number as hex (though it would be convenient).

You can format a cell as text (that's important, in case all the digits are 0-9), enter a hex string, and then use HEX2DEC() to convert it to a decimal number. 

It's (slightly) analagous to how Excel represents complex numbers; what you see (the string) is what is stored, and only functions that expect such string representations (the functions that handle complex numbers) can use it.

VBA can use hex strings for integer (Byte, Integer, Long) constants: someLong = &HABCD.

----------


## Gougie

Thanks for the help!!!

Strange that Excel can't handle intrepreting numbers that are 0x<format>. I do Embedded Systems so most of the data is in Hex.  

The:

   HEX2DEC(number) routine

Would have been really useful if I could put a cell rather than a number.

Any ideas?

----------


## JRock

You should be able to put a cell in.  Ie =HEX2DEC(A2)

Need to make sure you don't have the trailing x on the hex number though.

Would have to be "0A4" instead of "0A4x" in cell A2

Good Luck

----------


## Mike Mu

> You should be able to put a cell in.  Ie =HEX2DEC(A2)
> 
> Need to make sure you don't have the trailing x on the hex number though.
> 
> Would have to be "0A4" instead of "0A4x" in cell A2
> 
> Good Luck



I have just encountered the same problem. How to fix this?
Suppose you have values in the form of 
0xDEADBEEF
0x10011001

etc in column A after importing the output of the other program
Then edit cell B1 and enter =HEX2DEC(RIGHT(A1;LEN(A1)-2))
The actual value is now in B1
Extend this to the other values by double-clicking the small dot on the bottom right of the cell.
0xDEADBEEF	3735928559
0x10011001	268505089

----------


## Fotis1991

Mike welcome to the forum.

This is an(almost)* 5 years old thread*. As per forum rules, you have to start your own thrad and if you like to provide a link to this one.

----------


## zbor

Correct. I will close this one.

----------

