How do I get MS Excel "IF" function to work with three variables?

Posted on 2011-10-14
Last Modified: 2012-05-12
I can't get this formula to work?
=IF(E17=1,">> YES <<",IF(E17>=2,">> NO <<", IF(E17=3," >> N/A <<")))
Question by:cssc1
    LVL 43

    Accepted Solution




    LVL 41

    Assisted Solution

    if you're dealing with E17 being 1, 2, or 3, you can simplify, using the choose statement,

    For example:

    =CHOOSE(E17,">> YES <<",">> NO <<"," >> N/A <<")  yes, for 1  no for 2, and n/a for 3

    you can put an IFERROR around that or IF(ISERROR in 2000-2003 if you want to trap values other than 1,2, or 3.

    LVL 3

    Assisted Solution

    You should change the order of conditions:

    =IF(E17=1,">> YES <<",IF(E17=3," >> N/A <<",IF(E17>=2,">> NO <<")))

    LVL 27

    Assisted Solution

    by:Glenn Ray
    The CHOOSE function is best.  

    Another way to avoid having an error returned would be to add data validation to cell E17 to only allow values of 1,2, or 3 in that cell.

    Also, what value would you want returned if E17 is blank?  That's a case where the IFERROR function (in Excel 2007) or IF(ISERROR()) nested functions (in Excel 2003) would be helpful.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    I've recently been in need of an Excel macro that could add a letter before the text on multiple cells in an Excel document. My English is as it is, so I will try explain what it does diffrently. If you have an excel document with 2000 rows an…
    Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
    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 how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

    758 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

    12 Experts available now in Live!

    Get 1:1 Help Now