+ Reply to Thread
Results 1 to 4 of 4

Calulating Time Between Two Dates/Times but Excluding Weekends and Holidays

  1. #1
    Registered User
    Join Date
    03-14-2013
    Location
    New York, NY
    MS-Off Ver
    Excel 2010
    Posts
    2

    Calulating Time Between Two Dates/Times but Excluding Weekends and Holidays

    We are using a case management system and I need to calculate the average time it takes for a case to be closed. There are several nuances with this request that are as follows:

    -Weekends need to be excluded
    -Holidays need to be excluded
    -Workday is 8:00 AM to 9:00 PM
    -13 hour workday

    The attached document outlines the following:

    Cell F1 - Case opened date
    Cell G1 - Case closed date (if applicable)
    Cell H1 - Hours between F and G in decimal hours (using workday, but not sure if workday can identify cases opened outside of 8AM and 9PM)
    Cell I1 - Overall average for hours > 0
    Tab 2 - Company Holidays

    I need to be able to calculate the average time to close a case excluding weekends, holidays, and not calculating hours outside 9:00 PM and 8:00 AM.

    Any help would be GREATLY appreciated!!

    Thanks,

    Ray
    Attached Files Attached Files

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

    Re: Calulating Time Between Two Dates/Times but Excluding Weekends and Holidays

    Hello Ray,

    Try this formula in H2 copied down

    =IF(COUNT(F2,G2)=2,13*(NETWORKDAYS(F2,G2,'Company Holidays'!B$1:B$9)-1)+IF(NETWORKDAYS(G2,G2,'Company Holidays'!B$1:B$9),MEDIAN(MOD(G2,1)*24,8,21),21)-MEDIAN(NETWORKDAYS(F2,F2,'Company Holidays'!B$1:B$9)*MOD(F2,1)*24,8,21),"")

    That will show a blank unless there is an entry in both creation and closed date columns. If there is an entry it calculates time between 08:00 and 21:00 on all weekdays except holidays - works even if creation or closed dates/times are outside the business hours

    As you will only have valid values in there you can simply average the column with

    =AVERAGE(H:H)

    that ignores the blanks but includes the zero values, to ignore zeroes too use AVERAGEIF like

    =AVERAGEIF(H:H,">0")
    Audere est facere

  3. #3
    Registered User
    Join Date
    03-14-2013
    Location
    New York, NY
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Calulating Time Between Two Dates/Times but Excluding Weekends and Holidays

    Awesome, thanks again for the help!

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Calulating Time Between Two Dates/Times but Excluding Weekends and Holidays

    I have marked this thread solved for you.

    In the future please select Thread Tools from the menu above and mark the thread as solved. Thanks.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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