+ Reply to Thread
Results 1 to 7 of 7

How to use an IF statement with multiple outcomes

  1. #1
    Forum Contributor
    Join Date
    09-17-2009
    Location
    Torquay, England
    MS-Off Ver
    Excel 2013
    Posts
    253

    How to use an IF statement with multiple outcomes

    Hi,

    I want to say, if B1 = A then the value is 10, if B1 = B then the value is 20, if C then the value is 30 and D the value is 40.

    If there are two conditions then I know it would be =if(b1=A,10,0) but this is obviously a bit more complex.

    Thanks

    Matt
    Last edited by Gooford; 12-08-2009 at 05:25 AM.

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

    Re: How to use an IF statement with multiple outcomes

    You can use a nested IF.. like so

    =IF(B1="A",10,IF(B1="B",20,IF(B1="C",20,IF(B1="D",40,"")

    or simpler and more versatile...

    =Lookup(B1,{"A","B","C","D"},{10,20,30,40})
    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.

  3. #3
    Forum Contributor
    Join Date
    09-17-2009
    Location
    Torquay, England
    MS-Off Ver
    Excel 2013
    Posts
    253

    Re: How to use an IF statement with multiple outcomes

    ace, I had forgotten about Lookup.

    Cheers!

  4. #4
    Forum Contributor
    Join Date
    09-17-2009
    Location
    Torquay, England
    MS-Off Ver
    Excel 2013
    Posts
    253

    Re: How to use an IF statement with multiple outcomes

    Using the Lookup, how do I put in a line to show "" for any inputs other than A B Cor D?

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

    Re: How to use an IF statement with multiple outcomes

    Try:

    =LOOKUP(B1,{"A","B","C","D","E"},{10,20,30,40,""})

  6. #6
    Forum Expert darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    2,191

    Re: How to use an IF statement with multiple outcomes

    In the off chance you might have blank or a number in B1, you could change it to
    =LOOKUP(B1,{0,"A","B","C","D","E"},{"",10,20,30,40,""})

  7. #7
    Forum Contributor
    Join Date
    09-17-2009
    Location
    Torquay, England
    MS-Off Ver
    Excel 2013
    Posts
    253

    Re: How to use an IF statement with multiple outcomes

    Cheers thanks

+ 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