+ Reply to Thread
Results 1 to 5 of 5

NESTED IFs with Time and dates

  1. #1
    Registered User
    Join Date
    05-12-2016
    Location
    Newcastle, England
    MS-Off Ver
    2010
    Posts
    10

    NESTED IFs with Time and dates

    My queries all seem to link to using formula with TIME in them, they just never seem to work. The below is quite clunky, i was hoping to make it work then streamline it but struggling with the working bit first......

    So the formula in question links into quite a large spreadsheet that has a variety of workstreams on it so the first few If's are basically just ignoring the row if the work function isn't what i'm looking for,

    =IF(AU43="IGNORE","Not Eligible for GSOP",IF(AU43<>"ECO","Scheduled Work",IF(AND(AU43="ECO",N43="SUNDAY"),"4 Hours SLA",IF(AND(AU43="ECO",N43="Saturday",Q43>=TIME(9,0,0),Q43<=TIME(16,0,0)),"3 Hours SLA",IF(AND(LEFT(N43,3)={"MON","TUE","WED","THU","FRI"},Q42>=TIME(20,0,0),Q42<=TIME(8,0,0)),"4 Hours SLA","3 Hours SLA")))))
    so:

    IF(AU43="IGNORE","Not Eligible for GSOP" - works and basically tells the user based on an earlier formula, no compensation needs paid

    IF(AU43<>"ECO","Scheduled Work" - works, puts all the work streams i'm not interested in, into another 'pot'

    IF(AND(AU43="ECO",N43="SUNDAY"),"4 Hours SLA" - All jobs on a Sunday have 4 hours to complete, regardless of when int he day we received them - works finethen it starts to go wrong.....

    IF(AND(AU43="ECO",N43="Saturday",Q43>=TIME(9,0,0),Q43<=TIME(16,0,0)),"3 Hours SLA" - this job type on a Saturday between 9am and 4pm has a 3 hours completeion time, either side of this on a Saturday. I've tried testing this on its own as IF(AND(AU43="ECO",N43="Saturday",Q43>=TIME(9,0,0),Q43<=TIME(16,0,0)),"3 Hours SLA","4hr Standard" and the logic works, it goes wrong in the nested formula though

    IF(AND(LEFT(N43,3)={"MON","TUE","WED","THU","FRI"},Q42>=TIME(20,0,0),Q42<=TIME(8,0,0)),"4 Hours SLA","3 Hours SLA" I've only recently added the other days of the week in, originally i just had IF(AND(Q42>=TIME(20,0,0),Q42<=TIME(8,0,0)),"4 Hours SLA","3 Hours SLA" but everything comes out as 3 hours, so basically its defaulting to the false outcome on everything.

    Where am i going wrong - am i trying to do too much, is there a different logic to apply. i've spent so long looking at this i'm struggling to take a step back to see a better way of putting it together. Any help much appreciated as i'm just formula blind at the minute :-)

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: NESTED IFs with Time and dates

    It would be much easier to help if we had the data so please post a small sample file (mot image).

    To upload file, click "Go advanced" the scroll down to "Manage Attachments"

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: NESTED IFs with Time and dates

    What is in AU43 for this test ?

    IF(AND(LEFT(N43,3)={"MON","TUE","WED","THU","FRI"},Q42>=TIME(20,0,0),Q42<=TIME(8,0,0)),"4 Hours SLA","3 Hours SLA")))))

    Perhaps ...

    IF(AND(OR(LEFT(N43,3)="MON",LEFT(N43,3)="TUE",LEFT(N43,3)="WED",LEFT(N43,3)="THU",LEFT(N43,3)="FRI"),OR(Q43>=TIME(20,0,0),Q42<=TIME(8,0,0))),"4 Hours SLA","3 Hours SLA")))))

    Or

    IF(AND(OR(N43,<>"Saturday",N43<>"Sunday"),OR(Q43>=TIME(20,0,0),Q42<=TIME(8,0,0))),"4 Hours SLA","3 Hours SLA")))))

    it is important the sequence of tests are correct.

    and should Q42 be Q43 ?
    Last edited by JohnTopley; 07-24-2016 at 12:43 PM.

  4. #4
    Forum Contributor
    Join Date
    06-30-2015
    Location
    Netherlands
    MS-Off Ver
    2013 / 2016 / 365
    Posts
    145

    Re: NESTED IFs with Time and dates

    Hi,

    It looks like you've mixed up the logic. The separate parts of the formula do not match the full formula you've mentioned.
    Try this as a alternative:

    =IF(AU43="IGNORE","Not Eligible for GSOP",IF(AU43<>"ECO","Scheduled Work",CHOOSE((((LEFT(N43,3)="Sun")*(AU43="ECO"))*1)+(((LEFT(N43,3)="Sat")*(AU43="ECO")*(MEDIAN("9:00","16:00",Q43)=Q43))*2)+(((LEFT(N43,3)="Sat")*(AU43="ECO")*(MEDIAN("9:00","16:00",Q43)<>Q43))*3)+(((LEFT(N43,3)<>"Sun")*(LEFT(N43,3)<>"Sat")*(AU43="ECO")*MEDIAN(Q43,"08:00","20:00")=Q43)*4)+((LEFT(N43,3)<>"Sun")*(LEFT(N43,3)<>"Sat")*(AU43="ECO")*(MEDIAN(Q43,"08:00","20:00")<>Q43)*5),"4 Hrs SLA","3 Hrs SLA","4 Hrs SLA","4 Hrs SLA","3 Hrs SLA")))

    It a long one but does the trick!.
    Hope this helps.

  5. #5
    Registered User
    Join Date
    05-12-2016
    Location
    Newcastle, England
    MS-Off Ver
    2010
    Posts
    10

    Re: NESTED IFs with Time and dates

    thank you very much, it works !!!

    What a legend :-)

+ 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. Replies: 12
    Last Post: 06-13-2014, 05:03 PM
  2. [SOLVED] Help with Nested IFS and Dates
    By Lizzy1965 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-09-2014, 08:25 AM
  3. If/And Nested Statement between dates
    By noobtoexcel in forum Excel General
    Replies: 4
    Last Post: 03-02-2012, 12:12 PM
  4. Help with nested IF formula to group dates
    By PRodgers in forum Excel General
    Replies: 3
    Last Post: 07-19-2009, 02:45 PM
  5. Nested IF statements with dates
    By jpg1982 in forum Excel General
    Replies: 2
    Last Post: 02-18-2009, 05:25 PM
  6. Nested IFs:bottom row of dates
    By garethgtt in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-21-2007, 01:39 PM
  7. [SOLVED] scheduling dates nested loops ...
    By jer in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-21-2005, 10:05 PM

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