+ Reply to Thread
Results 1 to 4 of 4

Calculate elapsed hours between two date/time excluding weekends.

  1. #1
    Registered User
    Join Date
    03-19-2024
    Location
    Carbondale,Coloradao
    MS-Off Ver
    365
    Posts
    6

    Calculate elapsed hours between two date/time excluding weekends.

    Hello,

    I am trying to use the NETWORKDAYS formula to calculate the elapsed time in hours between two cells that both contain a date/time. I have attached an example fo the data. Thank you for your help!
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    03-19-2024
    Location
    Carbondale,Coloradao
    MS-Off Ver
    365
    Posts
    6

    Re: Calculate elapsed hours between two date/time excluding weekends.

    I figured out my issue but am now having another one in certain cells.

    I used this formula =NETWORKDAYS(D2,E2)-1-MOD(D2,1)+MOD(E2,1) which is working for most cells. However, I have a few that I am getting an ########## error in the cell where the calculation is supposed to be.

    Example: D cell contains 3/8/2024 9:55 PM and E cell contains 3/10/2024 9:09 PM. The error states " Dates and times that are negative or too large show as ####" The calculation would not result in a negative number and the resulting number should be ~48 so it's not too big.

    Any suggestions?

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,594

    Re: Calculate elapsed hours between two date/time excluding weekends.

    Provide a sample workbook with 10 examples, including some that produce the wrong result - where there is an incorrect result, fill in the expected result manually next to it.

    Or you could try this:

    =(C2-B2)*24

    BUT I have no idea what result you are expecting as you didn't tell us that!
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  4. #4
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,465

    Re: Calculate elapsed hours between two date/time excluding weekends.

    The formula you came up with only works well when the first and last day is a working day.

    In the example of Friday March 8, 2024 9:55 PM and Sunday March 10 9:09 PM this is not the case.
    Moreover, in the latter case I would expect a result of 2:05 hours.

    This formula takes into account that the first or last day does not have to be a working day:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

+ 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. Replies: 35
    Last Post: 04-06-2024, 09:01 AM
  2. [SOLVED] Elapsed Days Hours Minutes Excluding Weekends and Holidays
    By moshjosh in forum Excel General
    Replies: 7
    Last Post: 12-10-2012, 08:39 AM
  3. Replies: 4
    Last Post: 08-10-2012, 11:41 AM
  4. Replies: 0
    Last Post: 04-16-2012, 05:47 AM
  5. Replies: 0
    Last Post: 04-16-2012, 04:31 AM
  6. Replies: 3
    Last Post: 12-23-2010, 04:46 PM
  7. How to calculate elapsed time between to days excluding weekends.
    By Mush001 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-23-2009, 04:19 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