+ Reply to Thread
Results 1 to 10 of 10

Working out times over midnight with a twist

  1. #1
    Registered User
    Join Date
    03-23-2017
    Location
    Northern Ireland
    MS-Off Ver
    Office 2010
    Posts
    24

    Working out times over midnight with a twist

    We have A1 (Requested time) B1 (Allocated) time C1 (Started time) D1 (Completed time)

    I am looking to report on two things (time taken to allocate a job, relative to the requested time) & Time taken from start to complete of the job.

    I am using =MOD(B1-A3,1) so that any jobs requested/started before midnight and allocated/completed after midnight still give a value.

    However we sometimes allocate a job before the requested time (usually just a few minutes).

    Is there any way i can work my formula to provide a zero value if the requested time after the allocated time?
    Last edited by Custhasno; 01-27-2018 at 10:23 AM. Reason: Solved

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,101

    Re: Working out times over midnight with a twist

    Will you please attach a SMALL sample Excel workbook (10-20 rows of data is usually enough)? Please don't attach a picture of one (no-one will want to re-type all your stuff before starting).

    1. Make sure that your sample data are truly REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential information is removed first!!

    4. Try to avoid using merged cells. They cause lots of problems!

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Registered User
    Join Date
    03-23-2017
    Location
    Northern Ireland
    MS-Off Ver
    Office 2010
    Posts
    24

    Re: Working out times over midnight with a twist

    Thanks,

    https://1drv.ms/x/s!Al2crTwFMkojnxBNtZAimXuSCzXG

    You'll see in bold the cells that have the issue i wish to avoid, where a job is allocated a few minutes before the requested time (the time the customer is asking us to call at)

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,101

    Re: Working out times over midnight with a twist

    Hi there, try this:

    =IF(AND(A2=C2,D2<B2),0,MOD(D2-B2,1))

  5. #5
    Registered User
    Join Date
    03-23-2017
    Location
    Northern Ireland
    MS-Off Ver
    Office 2010
    Posts
    24

    Re: Working out times over midnight with a twist

    Thank you kindly

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,101

    Re: Working out times over midnight with a twist

    You're welcome... from windy Belfast!!

  7. #7
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Working out times over midnight with a twist

    Quote Originally Posted by Glenn Kennedy View Post
    =IF(AND(A2=C2,D2<B2),0,MOD(D2-B2,1))
    Surely this won't work as required if allocated time is just before midnight one day and request time just after midnight the next?

    As you have the dates as well as the times you don't really need to use MOD, the time difference is just the allocated time/date minus the requested time/date, so this formula will give you that with MAX used to ensure you get zero when the allocated time/date is before the requested time/date

    =MAX(0,D2+C2-B2-A2)
    Audere est facere

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,101

    Re: Working out times over midnight with a twist

    Don't rows 2 & 3 cover your scenario? that said, your formula is 50% quicker than mine...
    Attached Files Attached Files

  9. #9
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Working out times over midnight with a twist

    Hello Glenn,

    No, there are no examples in the data of that scenario.

    Custhasno wanted a formula that will return zero in a scenario like row 19 where request time/date is 6 minutes after Allocated time/date, so if that 6 minutes occurred across midnight (which I assume may be possible) then shouldn't the answer still be zero, e.g. if the request time/date in row 55 is 10 minutes later, i.e. 22/10/2017 at 00:05, but Allocated time remains at 21/10/2017 at 23:59?

    That's another instance of the request time being after the allocated time, but your formula gives 23:54

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,101

    Re: Working out times over midnight with a twist

    Sigh!! As usual you're right.... Obviously we don't know what the background is, in full, but there are indeed many instances where the allocated D/T is < the requested D/T.

    Exit stage left, in pursuit of a beer - as Shakespeare intended to write....

+ 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. Average of Times Spanning Midnight
    By LJenny in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 11-24-2015, 10:44 AM
  2. [SOLVED] Difference between two times - avoiding ###### for times that span midnight
    By Abarency in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-07-2015, 01:15 PM
  3. Trying to calculate +/- min for actual times before and after midnight
    By WTFCanucks in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 11-11-2014, 12:08 PM
  4. Graphing completion times across midnight
    By wrudiger in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 06-28-2013, 03:18 PM
  5. difference between times not working for after midnight.
    By superchew in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-28-2013, 01:47 AM
  6. Median of Two Times Over Midnight
    By melissaallen5 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-11-2012, 12:56 AM
  7. Times and midnight issues
    By bslob in forum Excel General
    Replies: 1
    Last Post: 12-08-2007, 01:36 AM

Tags for this Thread

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