Link to home
Start Free TrialLog in
Avatar of Frankkadaf
Frankkadaf

asked on

Excel if/then

If I have a letter in cell A1, and want a corresponding number to go in A2, what would my formula be?

I would like the number 1 for A OR F; 2 for B OR G; 3 for C OR H; 4 for D OR J

Is it practical to use if/then?  What other formula could I use?
ASKER CERTIFIED SOLUTION
Avatar of ScriptAddict
ScriptAddict
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Another good option would to use a reference table placed somewhere else and Assign values by letter.  Then you could just do a lookup on the reference table.  I think I would use that approach as it's much cleaner if you ever need to add letters.
Here's what I played with.
IfthenAlternatives.xlsx
If it is always 2 at a time then you can use something like

=INT(MATCH(A1,{"";"A";"F";"B";"G";"C";"H";"D";"J"},0)/2)
Avatar of Frankkadaf
Frankkadaf

ASKER

Great formula, easy to use, especially if there are only a few options.  The lookup is also an option.

Thanks!