+ Reply to Thread
Results 1 to 6 of 6

Excel 2007 : Using nested logic in a formula that partially monitors previous results

  1. #1
    Registered User
    Join Date
    09-03-2010
    Location
    St. Albert, ALberta
    MS-Off Ver
    Excel 2007
    Posts
    2

    Using nested logic in a formula that partially monitors previous results

    I've been struggling for most of the morning trying to create the logic for the following problem.

    Here are the conditions I'm trying to monitor with a formula in the cells of column 2.

    1) If the date in column 3 is greater than the date in column 4, then all is OK.

    2) If the date in column 3 is less than the date in column 4, then that is No...unless the number in column 1 was the same as the one immediately above it and that one was OK.

    So, to clarify...in row 3 of my example, the column 3 date is less than than the column 4 date and the number in column 1 is the same as the number above it, but that result was No. Thus the result in row 3 column 3 should be No.

    In the last two rows of my example...the column 3 date is less than than the column 4 date and the number in the first column is the same as the number above it, but that result was OK. Thus the result should be OK.


    204133 OK 8/5/2010 7/26/2010
    204137 No 8/5/2010 8/6/2010
    204137 No 8/5/2010 8/6/2010
    204151 OK 8/5/2010 8/4/2010
    204273 OK 8/6/2010 5/30/2010
    204273 OK 8/6/2010 5/30/2010
    204277 OK 8/6/2010 5/30/2010
    204277 OK 8/6/2010 6/1/2010
    204310 No 8/6/2010 8/9/2010
    204559 No 8/10/2010 8/11/2010
    204570 OK 8/10/2010 8/6/2010
    204614 No 8/10/2010 8/11/2010
    204637 OK 8/10/2010 8/8/2010
    204637 OK 8/10/2010 8/16/2010
    Last edited by imasham; 09-03-2010 at 05:20 PM. Reason: Change thread title

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

    Re: Nested logic complication

    Assuming the data starts in row 2.. if not insert row above... then in B2 enter:

    =IF(OR(C2>D2,AND(A2=A1,B1="OK")),"OK","NO")

    copied down.
    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.

  3. #3
    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,445

    Re: Nested logic complication

    Is this the same as the formula that you came up with?

    =IF(C2>D2,"OK",IF(C2<D2,IF(AND(A2=A1,B1="OK"),"OK","No")))

    This produces the responses indicated above. Are they what you want or what you get?

    Regards

  4. #4
    Registered User
    Join Date
    09-03-2010
    Location
    St. Albert, ALberta
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Using nested logic in a formula that partially monitors previous results

    Thank you very much! I've been working for hours trying to get that. I could get it for some of the conditions but not for everything.

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

    Re: Using nested logic in a formula that partially monitors previous results

    Mine also was posting not seeing shg's request... I have now unhidden it for another alternative...

  6. #6
    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,445

    Re: Using nested logic in a formula that partially monitors previous results

    Just realised you'd changed it.

+ 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