Excel if/then

Posted on 2011-10-24
Last Modified: 2012-05-12
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?
Question by:Frankkadaf
    LVL 11

    Accepted Solution

    This should work

    Open in new window

    LVL 11

    Expert Comment

    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.
    LVL 11

    Expert Comment

    Here's what I played with.
    LVL 43

    Expert Comment

    by:Saqib Husain, Syed
    If it is always 2 at a time then you can use something like


    Author Closing Comment

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


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
    Introduction This Article is a follow-up to my Mappit! Addin Article (, it was inspired by an email posting I made to EUSPRIG (, I will briefly cover: 1) An overvie…
    This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
    This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now