adding hexadecimal numbers

G

Guest

Hi,
As the subject states, how do I add together cells containing hex numbers. I
tried
the following...

A1 contains 0f
a2 contains 0f
a3 contains = a1 + a2
result #VALUE!

I know that it knows the cells could be hex because if I do =hex2dec(a1) in
another cell it converts it. Is there anyway in Excel to explicitly set the
number type of a cell?

Regards,
Dave.
 
D

Dave Peterson

As long as your numbers fit in that =hex2dec() and =dec2hex() ranges:

=DEC2HEX(HEX2DEC(A1)+HEX2DEC(A2))

I don't know of anyway of using a custom format to display hex.
 
B

Bernard Liengme

You have nearly answered your own question:
=DEC2HEX(HEX2DEC(A1)+HEX2DEC(A2))
 
G

Guest

Thanks,
Thats what I did in the end. I just thought that with Excel being a big
number cruncher it would be a bit more flexible in the way you can use
numbers of a different base without having to jump through loops.

Regards,
Dave.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top