+ Reply to Thread
Results 1 to 4 of 4

*Urgent Help If Possible* Subtracting date/time accounting for work hours and weekends?

Hybrid View

  1. #1
    Registered User
    Join Date
    07-30-2012
    Location
    Washington DC
    MS-Off Ver
    Excel 2010
    Posts
    8

    Unhappy *Urgent Help If Possible* Subtracting date/time accounting for work hours and weekends?

    This is an emergency of sorts. I was just made aware of a metric I needed to include in a report that needs to go out today and I have no idea how to do it with what I know so far. I've checked over the forums and see other similar questions but I've tried the example solutions without success. I need to find the total time a ticket was opened but only counting work hours (7:30AM to 5:30PM) and not counting any weekend time. I'm attaching a sample document to this and cell E2 contains my attempt to modify a solution example I found in this forum. I'm not sure what I'm doing wrong. Essentially cell C2 is "date/time opened" and D2 is "date/time closed" and I would like E2 to display what the total hours are with the considerations listed above. Any ideas? I'm up a creek if I can't get this before I leave so any guidance would be extremely helpful.
    Attached Files Attached Files
    Last edited by Michael Perry; 04-04-2013 at 06:17 PM.

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

    Re: *Urgent Help If Possible* Subtracting date/time accounting for work hours and weekends

    Hello Michael,

    This formula should do what you want

    =(NETWORKDAYS(C2,D2)-1)*("17:30"-"7:30")+IF(NETWORKDAYS(D2,D2),MEDIAN(MOD(D2,1),"7:30","17:30"),"17:30")-MEDIAN(NETWORKDAYS(C2,C2)*MOD(C2,1),"7:30","17:30")

    Custom format result cell as [h]:mm
    Audere est facere

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: *Urgent Help If Possible* Subtracting date/time accounting for work hours and weekends

    Hi and welcome to the forum

    only counting work hours (7:30AM to 5:30PM)
    what do you want to do with times outside of that range? D11 = 1/7/2013 11:33:21 PM I didnt see any Start timed earlier than 7:30, but could there be?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    07-30-2012
    Location
    Washington DC
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: *Urgent Help If Possible* Subtracting date/time accounting for work hours and weekends

    You guys are awesome and you saved my skin. It worked like a charm. Thanks!

+ 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