+ Reply to Thread
Results 1 to 6 of 6

IF and AND nesting

  1. #1
    Registered User
    Join Date
    04-28-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    3

    IF and AND nesting

    I am trying to create a formula using IF and AND that will test for 2 conditions before producing a true or false result. Can anyone please advise how to do this?

    Many thanks

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: IF and AND nesting

    Create each formula individually so they work for TRUE/FALSE, then put them into an AND.

    =A1>C1
    =B1<TODAY()

    =AND(A1>C1, B1<TODAY())
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Valued Forum Contributor
    Join Date
    04-03-2012
    Location
    East Sussex, UK
    MS-Off Ver
    Excel 2003:2010
    Posts
    893

    Re: IF and AND nesting

    Just to expand on the above reply:

    =IF(AND(Condition1,Condition2),ActionIfTrue,ActionIfFalse)

    so for example

    =IF(AND(A1>C1,B1<TODAY()),"BothConditionsMet","BothConditionsNotMet")

  4. #4
    Registered User
    Join Date
    04-28-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: IF and AND nesting

    Many thanks for the response. Unfortunately, I contrusted the formula exactly as suggested, but it didn't work and so resorted to this forum for help.

    The example/test I created was to enter value "A" in cell A1 and value "B" in cell B1.

    In cell C1, I created the formula: =IF(AND(A1=A,B1=B),"X","Y"), but this resulted in the #NAME? response.

    I reckon I must be making a simple mistake somehwere (in the syntax used perhaps?), but can't quite fugure out the problem!

    Do you have any suggestions?

    Again, many thanks.

  5. #5
    Registered User
    Join Date
    04-28-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: IF and AND nesting

    Sorry, just realized my mistake! Needed to put the values used in quotes!! It works now.

    Many thanks for you help.

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: IF and AND nesting

    If that takes care of your need, please select Thread Tools from menu above and set this topic to SOLVED.

+ 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