+ Reply to Thread
Results 1 to 7 of 7

Calculating Hours Between Two Date - Including Time

  1. #1
    Registered User
    Join Date
    11-02-2012
    Location
    Michigan
    MS-Off Ver
    Excel 2010
    Posts
    18

    Calculating Hours Between Two Date - Including Time

    I have a spreadsheet where I am trying to calculate the time between when a report is submitted to when the final is sent to the customer excluding weekends. I am currently using a NETWORKDAYS.INTL formula, but this is only calculating between the dates. For example:

    Cell A2 = 2/28/16 8:25 PM
    Cell B2 = 3/3/16 8:13 AM

    I should be getting that there is a difference of 80 Hours and 12 Minutes when excluding weekends. What I am getting instead is 59 hours and 48 minutes. The formula I am using is subtracting a full 24 hours instead of the 3 hours and 35 minutes it should be. This is the formula I am using:

    =NETWORKDAYS.INTL(A2,B2)-1-MOD(A2,1)+MOD(B2,1)

    Can someone help me figure out how to get this to work with the time so it excludes Saturday at 12:00 AM until Sunday at 11:59 PM?

    I appreciate the help!

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Calculating Hours Between Two Date - Including Time

    Please Login or Register  to view this content.

    I just spotted the bit about ignoring Saturday-Sunday specified hours.

    That gets complicated. I would have to use a userdefined function for that.
    Last edited by mehmetcik; 03-04-2016 at 02:46 PM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Calculating Hours Between Two Date - Including Time

    I think this works? I've been toying around with it and it appears to hold up. Give it a try...

    =IF(WEEKDAY($B4,2)>5,IF(WEEKDAY($A4,2)>5,NETWORKDAYS($A4,$B4),NETWORKDAYS($A4,$B4)-(MOD($A4,1))),IF(WEEKDAY($A4,2)>5,NETWORKDAYS($A4,$B4)-(1-MOD($B4,1)),NETWORKDAYS($A4,$B4)-(1-MOD($B4,1))-MOD($A4,1)))
    Last edited by CAntosh; 03-08-2016 at 10:53 AM.

  4. #4
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,919

    Re: Calculating Hours Between Two Date - Including Time

    Try =NETWORKDAYS.INTL(A2,B2)-1-MOD(A2,1)*(WEEKDAY(A2,2)<6)+MOD(B2,1)*(WEEKDAY(B2,2)<6)

  5. #5
    Registered User
    Join Date
    11-02-2012
    Location
    Michigan
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Calculating Hours Between Two Date - Including Time

    Thank you this worked beautifully. I went with Phuocam's suggestion though as it was very similar. I was so close on my own, and appreciate the help!

  6. #6
    Registered User
    Join Date
    11-02-2012
    Location
    Michigan
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Calculating Hours Between Two Date - Including Time

    Quote Originally Posted by Phuocam View Post
    Try =NETWORKDAYS.INTL(A2,B2)-1-MOD(A2,1)*(WEEKDAY(A2,2)<6)+MOD(B2,1)*(WEEKDAY(B2,2)<6)
    Thank you Phuocam! Cantosh had another beautiful solution, but yours was a little simpler. I just needed to add the weekday portion it appears!

  7. #7
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,919

    Re: Calculating Hours Between Two Date - Including Time

    You're welcome, good luck!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Calculating Target Date/Time Based on Start date and hours - Excel 2007
    By chinraj in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 12-09-2019, 01:43 AM
  2. Calculating hours worked overnight, (including 24 hours)
    By Shaun3080 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-08-2015, 04:45 AM
  3. [SOLVED] Calculating hours worked overnight, (including 24 hours)
    By Shaun3080 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 04-07-2015, 08:16 AM
  4. How to count Working hours b/w two date and time including Saturday
    By sateeshkumarj in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-17-2014, 01:24 AM
  5. Replies: 6
    Last Post: 06-21-2012, 09:59 AM
  6. Calculating hours between two date/time entries
    By Paul Amato in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-07-2011, 05:37 PM
  7. calculating the number of working hours including saturday
    By drma in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-01-2010, 12:58 PM

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