+ Reply to Thread
Results 1 to 8 of 8

Elapsed Days Hours Minutes Excluding Weekends and Holidays

  1. #1
    Registered User
    Join Date
    04-22-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    8

    Elapsed Days Hours Minutes Excluding Weekends and Holidays

    This sounds simple but I have been pulling my hair out trying to figure out a solution. Any help before I go bald would be great.

    I need a formula which is able to calculate the duration in (days, hrs, mins) between two date\time values (eg 05/12/2012 5:30 PM and say 07/12/2012 5:45 PM); excluding weekends and holidays. I would like the result of the formula to read as follows "e.g 2 Days 0 Hrs and 15 Mins".

    Bit of context. Trainers delivery courses and mark the courses as ‘Completed’ in an electronic diary system. The diary records a date & time stamp of when the course was marked delivered. A penalty is payable if a trainer does not mark a course as ‘Completed’ within 24hrs of the end time of the course. This 24hr window excludes weekends and holidays (i.e if the course ends on a Friday at 5:00pm they have until Monday 4:59 pm to mark as delivered). Technically a trainer can mark a course delivered up to 2 hours prior to the end time of the course, so this would result in a negative figure if you did a simple ‘End Time’ minus Completed Time’

    Elapsed_Completion_Time.xlsx

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Elapsed Days Hours Minutes Excluding Weekends and Holidays

    Have you investigated the NETWORKDAYS.INTL function?
    Martin

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

    Re: Elapsed Days Hours Minutes Excluding Weekends and Holidays

    Do you want to show a negative time when completion is before the end date or would zero suffice? One of your completion dates is a Sunday (9th December 2012) is that valid? Could the end/completion dates be weekends or holidays?
    Audere est facere

  4. #4
    Registered User
    Join Date
    04-22-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Elapsed Days Hours Minutes Excluding Weekends and Holidays

    Daddylonglegs, thank you for responding. Please ignore the 9-Dec-12 my typo, as for completion dates which end before the end date. A negative figure would be preferable but not critical. The completion dates and end dates should not be weekends for now. Possibly a formula excluding weekend and one for including weekend if that not too much hassle?
    Last edited by moshjosh; 12-09-2012 at 07:50 PM.

  5. #5
    Registered User
    Join Date
    04-22-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Elapsed Days Hours Minutes Excluding Weekends and Holidays

    Quote Originally Posted by mrice View Post
    Have you investigated the NETWORKDAYS.INTL function?
    I can't see how that would solve my problem. If you could expand your suggestion that would be fab. Thanks for the effort in any case.

  6. #6
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Elapsed Days Hours Minutes Excluding Weekends and Holidays

    Try

    =NETWORKDAYS.INTL(C3,D3,1,$A$16:$A$24) & " days " & INT((D3-C3 - INT(D3-C3))*24) &" hours " & INT((D3-C3-(INT((D3-C3 - INT(D3-C3))*24)/24) - INT(D3-C3)) * 24 * 60) & " mins"

    in F3 and copy down.

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

    Re: Elapsed Days Hours Minutes Excluding Weekends and Holidays

    Assuming start and end dates will be working days and that negative values will always be in hours try this version in row 3 copied down

    =IF(E3<D3,"-"&TEXT(D3-E3,"h:mm"),NETWORKDAYS(D3,E3,A$16:A$24)-1-(MOD(E3,1)<MOD(D3,1))&" days "&TEXT(E3-D3,"h:mm"))

  8. #8
    Registered User
    Join Date
    04-22-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Elapsed Days Hours Minutes Excluding Weekends and Holidays

    Quote Originally Posted by daddylonglegs View Post
    Assuming start and end dates will be working days and that negative values will always be in hours try this version in row 3 copied down

    =IF(E3<D3,"-"&TEXT(D3-E3,"h:mm"),NETWORKDAYS(D3,E3,A$16:A$24)-1-(MOD(E3,1)<MOD(D3,1))&" days "&TEXT(E3-D3,"h:mm"))


    Works like a treat, many thanks daddylonglegs!!! mrice, i'm sure your formula works great also, I opted for the "thinner" forlmula, thank you for your time also.

    To make it more stable I have turned all the holiday dates for UK 2012/13 into ‘Excel Serial Number’ format and placed them in an array bracket.

    Please Login or Register  to view this content.

+ 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