+ Reply to Thread
Results 1 to 5 of 5

Syntax for formula that uses multiple conditions inside of multiple IF statements

  1. #1
    Registered User
    Join Date
    10-05-2012
    Location
    Longmont
    MS-Off Ver
    Excel 2010
    Posts
    30

    Syntax for formula that uses multiple conditions inside of multiple IF statements

    Hello!

    The most confusing thing about this post is the title...

    I have 2500 customers, each on their own row in the worksheet. Each customer has multiple leases (up to 4). For each lease, there is a column for the lease status that precedes the column for the lease's expiration date. So the columns from L to R would read: Customer Name, Lease 1, Lease 1 Expiration, Lease 2, Lease 2 Expiration, ...

    I'm trying to create a formula at the end of each customer's row that looks at whether or not each lease has a certain status AND is not expired (we have a 90 day grace period on lease expirations), and then returns text based on those results.

    I have the gist of the formula down, but I'm stuck on how I could combine the IF statements. I basically need to combine the following formulas into one:
    =IF(AND(B2="PR",C2>TODAY()-90),"Call Customer","")
    =IF(AND(D2="PR",E2>TODAY()-90),"Call Customer","")
    =IF(AND(F2="PR",G2>TODAY()-90),"Call Customer","")
    =IF(AND(H2="PR",I2>TODAY()-90),"Call Customer","")

    I've tried nesting the IFs and using the OR function, but I'm getting hung up on the syntax for both.

    Thanks in advance for your help.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Syntax for formula that uses multiple conditions inside of multiple IF statements

    maybe
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    03-30-2013
    Location
    Washington DC
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Syntax for formula that uses multiple conditions inside of multiple IF statements

    The one above is missing a a set of Parenthesis after the "AND"....

    Here is your correct answer, pop it in and try it:

    =IF(AND((B2="PR",C2>TODAY()-90),(D2="PR",E2>TODAY()-90),(F2="PR",G2>TODAY()-90), (H2="PR",I2>TODAY()-90)),”Call Customer”,”All Conditions Not Met”)

    www.excel-help.net

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Syntax for formula that uses multiple conditions inside of multiple IF statements

    @Excel-Help.net
    no parenthesis missing there, did you scroll across ? also the formula you have posted requires all conditions to be true if in fact it was a valid formula,whereas as the original question requires any to be true hence the OR.

    =IF(AND((B2="PR",C2>TODAY()-90),(D2="PR",E2>TODAY()-90),(F2="PR",G2>TODAY()-90), (H2="PR",I2>TODAY()-90)),”Call Customer”,”All Conditions Not Met”)
    is just wrong it will not work in fact you cant even enter that as it is structured wrongly
    id suggest
    www.excel-help.net probably could do with a bit of assistance
    Last edited by martindwilson; 04-02-2013 at 06:18 PM.

  5. #5
    Registered User
    Join Date
    10-05-2012
    Location
    Longmont
    MS-Off Ver
    Excel 2010
    Posts
    30

    Re: Syntax for formula that uses multiple conditions inside of multiple IF statements

    This worked perfectly. Nesting the ANDs within one big OR and using it all as the logical test in a single IF statement is something I never even considered, but it makes perfect sense.

    Thanks so much for your help!

+ 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