Trying to create a Hexadecimal to Decimal Binary Input

shyy

Well-known Member
Joined
Nov 6, 2008
Messages
1,484
Hey guys,

I am having trouble with an excel formula that should be easy. For some reason I can't think straight today and have done more complex formulas in the past. What I want to do is have a user input a number (0-9,A-F) which is a hexadecimal into a binary number by putting a bunch of if statements, so if a user puts A in cell A1, then put the number 10.

What I have is this, but it comes out true/false and not the numbers 10 or 12.

If I do for one letter, then it would work but when I try to do a OR statement thats where its comes out either true or false.

=OR(IF(TEXT(A1="A",1),10,0),IF(TEXT(A1="B",1),11,0))
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Thanks VoG!!!

But can you still correct my formula to get two if with or functions to work correctly.
 
Upvote 0
You wouldn't use OR, the syntax, for just A and B would be like this

=IF(A1="A",10,IF(A1="B",11,""))

but you can't nest 16 IFs (unless you have Excel 2007) so you might want to add them like this

=IF(A1="A",10)+IF(A1="B",11)+IF(A1="C",12)

or you could use MATCH like this

=MATCH(A1,{0,1,2,3,4,5,6,7,8,9,"A","B","C","D","E","F"},0)-1
 
Upvote 0

Forum statistics

Threads
1,214,947
Messages
6,122,411
Members
449,081
Latest member
JAMES KECULAH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top