+ Reply to Thread
Results 1 to 7 of 7

Thread: multiple conditions in =IF() formula

  1. #1
    Registered User
    Join Date
    02-10-2012
    Location
    Madison, Wisconsin
    MS-Off Ver
    Excel 2010 64bit
    Posts
    4

    multiple conditions in =IF() formula

    I need to develop a formula that will compare a value against 2 other values AND compare the same value against 2 other values and return a text value in the cell indicating, for instance, "GOOD" or "BAD", and there would be two such statements in the formula.

    Example: IF A>B and <C, AND A>D and <E, OR A>F and <G, AND A>H and <I. If both are true: GOOD. If both are false: BAD.

    I have tried applying some of the other solutions found in this forum, but I can't seem to get the formula right and I can't get a text value other than "True" or "False".

    Any help is appreciated.

    Thanks.
    Last edited by chancellor; 02-16-2012 at 07:43 PM.

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

    Re: multiple conditions in =IF() formula

    Something like:

    =IF(OR(AND(A1>B1,A1<C1,A1>D1,A1<E),AND(A1>F1,A1<G1,A1>H1,<I1)),"GOOD","BAD")
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

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

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

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  3. #3
    Registered User
    Join Date
    02-10-2012
    Location
    Madison, Wisconsin
    MS-Off Ver
    Excel 2010 64bit
    Posts
    4

    Re: multiple conditions in =IF() formula

    Thanks for the help. If I had correctly stated the conditions, it would probably work. I think the correct example would look like this:

    IF A>C,A<D and B>F,B<G OR A>D,A<E and B>H,B<I, THEN "GO","NO-GO"

    I think this is a more concise and accurate statement of the conditions. If it helps, this is a formula to determine whether the center of gravity in a loaded airplane is within limits. "A" represents computed gross weight, "B" represents computed center of gravity, "C" "D" "E" represent min/max weight limits and "F" "G" "H" "I" represent min/max CG limits at referenced weights. Within limits = "GO" and out of limits = "NO-GO". LIVES DEPEND ON THIS FORMULA BEING RIGHT 100% OF THE TIME

    Your help is appreciated.

    Rick

  4. #4
    Valued Forum Contributor OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,647

    Re: multiple conditions in =IF() formula

    You need to be precise in your explanation as to what the AND and OR bits relate to. For example do you mean:
    IF (A>C,A<D and B>F,B<G) OR (A>D,A<E and B>H,B<I), THEN "GO","NO-GO"
    or
    IF A>C,A<D and (B>F,B<G OR A>D,A<E) and B>H,B<I, THEN "GO","NO-GO"

    or something else?
    Good luck.

  5. #5
    Registered User
    Join Date
    02-10-2012
    Location
    Madison, Wisconsin
    MS-Off Ver
    Excel 2010 64bit
    Posts
    4

    Re: multiple conditions in =IF() formula

    Thanks OnErrorGoto0. I believe your first statement is correct. These are two separate conditions, only one of which can be True and the condition is "GO". If neither are True, then "NO-GO".

  6. #6
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: multiple conditions in =IF() formula

    It's a matter of re-arranging what I already gave you then:

    =IF(OR(AND(A1>C1,A1<D1,B1>F1,B1<G1),AND(A1>D1,A1<E1,B1>H1,B1<I1)),"GOOD","BAD")
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

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

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

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  7. #7
    Registered User
    Join Date
    02-10-2012
    Location
    Madison, Wisconsin
    MS-Off Ver
    Excel 2010 64bit
    Posts
    4

    Re: multiple conditions in =IF() formula

    Thanks, NBVC. That seems to work perfectly! I just can't get my mind around how the "AND" and "OR" functions work together. Again, thanks to everyone for all your help.

    Rick

+ 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.2.0