+ Reply to Thread
Results 1 to 10 of 10

More than 2 options for 'IF' statement

  1. #1
    Registered User
    Join Date
    06-08-2011
    Location
    Falls Church, VA
    MS-Off Ver
    Excel 2007
    Posts
    24

    More than 2 options for 'IF' statement

    I have a dropdown list consisting of three options: "YES, VARIATION, NO"

    I want to display data in the next cell based on the following,

    If "yes" is selected, data from cell t2 is displayed
    If "no" is selected, data is zero
    If "variation" is selected, data from cell w2 is displayed

    How can I do this? To my knowledge the =IF() function of a cell can only have two inputs.

  2. #2
    Registered User
    Join Date
    10-09-2009
    Location
    Cambridge, MA
    MS-Off Ver
    Excel 2003
    Posts
    61

    Re: More than 2 options for 'IF' statement

    =IF(A1="yes",t2,IF(A1="no",0,IF(A1="variation",w2,"Not One of the Three")))

    That should work. You need to "nest" the formulas. You can nest a lot more (up to 7 or 10 maybe).

  3. #3
    Registered User
    Join Date
    06-08-2011
    Location
    Falls Church, VA
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: More than 2 options for 'IF' statement

    Thanks for the reply, but I'm getting an error with that formula you provided of #NAME

    Here is my formula: =IF(W2=”YES”,L2,IF(W2=”NO”,0,IF(W2=”VARIATION”,V2)))

    For reference:

    The cell with the dropdown list is W2

    The cell for "YES" values is L2

    The cell for "VARIATION" values is V2

    And like I posted, I want the formula to return 0 if "NO" is selected.

    Any idea what I'm doing wrong?

  4. #4
    Registered User
    Join Date
    10-09-2009
    Location
    Cambridge, MA
    MS-Off Ver
    Excel 2003
    Posts
    61

    Re: More than 2 options for 'IF' statement

    You're last "if" statement needs a third component. That's why I put the "Not one of the three", because you need that additional piece. It's just what you want to show if none of the three are present.

  5. #5
    Registered User
    Join Date
    06-08-2011
    Location
    Falls Church, VA
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: More than 2 options for 'IF' statement

    I added that in but I'm still getting the same error message

  6. #6
    Registered User
    Join Date
    10-09-2009
    Location
    Cambridge, MA
    MS-Off Ver
    Excel 2003
    Posts
    61

    Re: More than 2 options for 'IF' statement

    Can you attach your file so that I can look at it?

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: More than 2 options for 'IF' statement

    The quote marks are wrong: try:

    =IF(W2="YES",L2,IF(W2="NO",0,IF(W2="VARIATION",V2,"Not One of the Three")))
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  8. #8
    Registered User
    Join Date
    06-08-2011
    Location
    Falls Church, VA
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: More than 2 options for 'IF' statement

    Here's the file
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    10-09-2009
    Location
    Cambridge, MA
    MS-Off Ver
    Excel 2003
    Posts
    61

    Re: More than 2 options for 'IF' statement

    Try this....
    Attached Files Attached Files

  10. #10
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: More than 2 options for 'IF' statement

    As I mentioned you have wrong quotes around the strings.. and your last string has no quotes at all... see my formula above.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1