+ Reply to Thread
Results 1 to 3 of 3

Excel 2007 : If Statement

  1. #1
    Registered User
    Join Date
    09-14-2011
    Location
    Ashburn, VA
    MS-Off Ver
    Excel 2007
    Posts
    3

    If Statement

    I need an if statement that can handle 3 variables.

    Example:
    If A1="X" then 1
    If A1="Y" then 2
    If A1="Z" then 3

    With standard if then I can only 2 outcomes.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,463

    Re: If Statement

    =IF(A1="X,1,IF(A1="Y",2,IF(A1="Z",3,4)))


    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


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

    Re: If Statement

    =MATCH(A1,{"X","Y","Z"},0)

    the X,Y,Z options are in order of what should correspond to 1,2,3.

    or assuming those are three only choices.

    =IF(A1="X",1,IF(A1="Y",2,3))
    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.

+ 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