+ Reply to Thread
Results 1 to 9 of 9

Calculate Networkdays for business hours only

  1. #1
    Registered User
    Join Date
    06-13-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Calculate Networkdays for business hours only

    Good day,

    I am attempting to create an excel formula that will not count hours:minutes after 17:00. If the time goes over 17:00, I would like it to start on the next business day.

    Working hours: 07:00-17:00

    Current formula: =10*(NETWORKDAYS(D2,E2)-1)-24*((MOD(D2,1)-MOD(E2,1)))

    Format for time entered is m/d/yyyy h:mm

    This works great, until it comes to work that was performed after working hours.

    example: (task started)cell D2: 1/10/13 18:55 (task ended)cell E2: 1/11/13 08:13 ...End result: -0.70 hours. I'm looking for 1.13 hours

    Please help,


    Thank you. JD

  2. #2
    Forum Expert Kevin UK's Avatar
    Join Date
    12-07-2010
    Location
    Radstock, Somerset
    MS-Off Ver
    365
    Posts
    1,922

    Re: Calculate Networkdays for business hours only

    Hi jdgreen

    Try the following formula.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Regards Kevin


    Merged Cells (They are the work of the devil!!!)

  3. #3
    Registered User
    Join Date
    06-13-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Calculate Networkdays for business hours only

    Kevin,

    Thank you for responding. I used your formula and saw that it was still off. I may have left something out. I'll paste a sample of what i have.

    The only time that will be after hours will be the start time. the end time will always be within business hours.
    Attached Files Attached Files

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,730

    Re: Calculate Networkdays for business hours only

    This version will work for that scenario

    =24*((NETWORKDAYS(D2,E2)-1)*("17:00"-"07:00")+MOD(E2,1)-MEDIAN(NETWORKDAYS(D2,D2)*MOD(D2,1),"17:00","07:00"))

    format result cell as number
    Audere est facere

  5. #5
    Registered User
    Join Date
    06-13-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Calculate Networkdays for business hours only

    Thank you very much. That seems to do the trick. I appreciate it.

    JD

  6. #6
    Registered User
    Join Date
    02-03-2016
    Location
    Switzerland
    MS-Off Ver
    2016
    Posts
    1

    Re: Calculate Networkdays for business hours only

    Thanks guys, even 3 years after your posts it helped me a lot :-) Good work! Tom

  7. #7
    Registered User
    Join Date
    02-15-2016
    Location
    Chicago, IL
    MS-Off Ver
    2016
    Posts
    2

    Re: Calculate Networkdays for business hours only

    Extremely helpful. Was able to validate the negative values as time occurring during non-business hours.

  8. #8
    Registered User
    Join Date
    02-15-2016
    Location
    Chicago, IL
    MS-Off Ver
    2016
    Posts
    2

    Re: Calculate Networkdays for business hours only

    Coming back to this formula, I'm having issues. My business hours are 8:00AM - 5:00PM.

    (start time) D2 = 2/18/2016 8:00:00 AM
    (end time) E2 = 2/18/2016 6:00:00 PM

    Business Hours = 9

    Formula is returning 10 business hours, =24*((NETWORKDAYS(D2,E2)-1)*("17:00"-"08:00")+MOD(E2,1)-MEDIAN(NETWORKDAYS(D2,D2)*MOD(D2,1),"17:00","08:00"))

    What am I doing wrong?

  9. #9
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,963

    Re: Calculate Networkdays for business hours only

    eraymond,
    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    Ben Van Johnson

+ 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