+ Reply to Thread
Results 1 to 6 of 6

Need to subtract two dates/times taking into account holidays, weekends.

  1. #1
    Registered User
    Join Date
    05-11-2012
    Location
    New York, New York
    MS-Off Ver
    Excel 2010
    Posts
    11

    Red face Need to subtract two dates/times taking into account holidays, weekends.

    My Excel 2010 spreadsheet is a live spreadsheet exported from SharePoint. It tracks user requests which can come in at any time/day.

    I have two columns - Created and Completed that I need to understand the difference between the date/time the request is created to when its completed.

    Example:
    Column Header - "Created" - 5/7/2012 10:07
    Column Header - "Completed" - 5/7/2012 12:25

    Its in military time.

    I need to find the difference between the two times, taking into account holidays and weekends. The requests can come into the system at any point of time however (night /day/holidays/etc)

    Your guidance is very much appreciated!

  2. #2
    Forum Contributor
    Join Date
    04-24-2012
    Location
    Moscow
    MS-Off Ver
    Excel 2010
    Posts
    291

    Re: Need to subtract two dates/times taking into account holidays, weekends.

    have you tried =workday function?

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

    Re: Need to subtract two dates/times taking into account holidays, weekends.

    The function you want is called NETWORKDAYS() and it allows you to specify holidays to exclude, too.
    _________________
    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!)

  4. #4
    Registered User
    Join Date
    05-11-2012
    Location
    New York, New York
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Need to subtract two dates/times taking into account holidays, weekends.

    Thank you for the quick replies. I tried the networkdays but it only brings back days, I'd like to know hours and minutes.
    For example if a request was entered at 10am on Monday and completed at 1pm on Monday, the formula will bring back 1 even though its really 3 hours.
    This is my formula: =NETWORKDAYS([@Created], [@[Completed Date]], 'Do NOT DELETE Time Frames'!N$2:N$12)

  5. #5
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,037

    Re: Need to subtract two dates/times taking into account holidays, weekends.

    Maybe this:

    =(NETWORKDAYS([@Created],[@[Completed Date]],'Do NOT DELETE Time Frames'!N$2:N$12)-1+([@[Completed Date]]-INT([@[Completed Date]]))-([@Created]-INT([@Created]))

    {or for easier to read: =(NETWORKDAYS(A2,B2,'Dates to Exclude'!$A$2:$A$1000)-1)+(B2-INT(B2))-(A2-INT(A2)) }

    And format cell as [h]:mm
    Never use Merged Cells in Excel

  6. #6
    Registered User
    Join Date
    05-11-2012
    Location
    New York, New York
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Need to subtract two dates/times taking into account holidays, weekends.

    THANK YOU WORKED GREAT!!!

    Now I wanted to add one more thing and I have a question.

    I have these two formulas:

    This gives me the days/hours/minutes but does not take into account weekends and holidays
    =INT([@[Completed Date]]-[@Created])&"days "&INT(MOD([@[Completed Date]]-[@Created],1)*24)&"hrs "&INT(MOD(MOD([@[Completed Date]]-[@Created],1)*24,1)*60)&"mins"

    This gives me the days but because it rounds, its too general, it would be nice to see the days/hours/minutes.
    =NETWORKDAYS([@Created], [@[Completed Date]], 'Do NOT DELETE Time Frames'!N49:N59)

    How can I combine the two formulas to figure out the days/hours/min excluding weekends and holidays?

+ 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