+ Reply to Thread
Results 1 to 5 of 5

if and / or statement

  1. #1
    Registered User
    Join Date
    10-10-2012
    Location
    new jersey
    MS-Off Ver
    Excel 1997
    Posts
    13

    if and / or statement

    i am looking for a way to have an if statement that has at most 20 possible inputs and display only 3 outputs so "if (A1=a or b display ans "40") if (A1=c or d or e or f display and "45") if (A1=g or h or i ...or t display and "50")

    all the letters "a" through "t" represent a word

    for example: If i need to know the value of "h" it will display "50"

  2. #2
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: if and / or statement

    Try this

    =IF(OR(A1="a",A1="b"),40,IF(OR(A1="c",A1="d",A1="e",A1="f"),45,50))


    This assumes there isn't a 21st option ie "u"
    Happy with my advice? Click on the * reputation button below

  3. #3
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: if and / or statement

    Make a tabel with the inputoptions and in the next column add the display-values.

    After that you can use VLookup to find the results.

    Advantice:

    1) The formula keeps shorter and easier to understand.

    2) It is easier to change the values.

    3) depends on the excel version, you don't get problems with the "limited" if statements.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  4. #4
    Registered User
    Join Date
    10-10-2012
    Location
    new jersey
    MS-Off Ver
    Excel 1997
    Posts
    13

    Re: if and / or statement

    Thank You Crooza your information works perfectly!!!!

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: if and / or statement

    Quote Originally Posted by Crooza View Post

    =IF(OR(A1="a",A1="b"),40,IF(OR(A1="c",A1="d",A1="e",A1="f"),45,50))
    You can shorten that a bit:

    =IF(OR(A1={"a","b"}),40,IF(OR(A1={"c","d","e","f"}),45,50))
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. compile error expected line number statement end statement
    By mattress58 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-18-2014, 10:12 AM
  2. VBA Compile Error : line number or label or statement or end of statement
    By excellearner121 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-04-2013, 06:41 PM
  3. Replies: 4
    Last Post: 06-01-2012, 10:05 AM
  4. Replies: 4
    Last Post: 05-16-2012, 05:33 PM
  5. [SOLVED] Utilize a Select Case Statement in Target Intersect Statement
    By max57 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-29-2009, 08:55 PM

Tags for this Thread

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