+ Reply to Thread
Results 1 to 7 of 7

How do you calculate the hours between two dates excluding the weekends?

  1. #1
    Registered User
    Join Date
    06-18-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    27

    Question How do you calculate the hours between two dates excluding the weekends?

    Hi, how do you calculate the hours between two dates excluding the weekends?

    A1: 06/06/2013 12:00 AM

    B1: 06/12/2013 12:00 AM

    I get 144:00 as difference using the formula =IF(B1="","",(B1-A1))

    However June 8 and June 9 are weekends here in our place, so the result needs to be 96:00
    Last edited by Charoum; 08-02-2013 at 11:58 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    05-20-2013
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2013
    Posts
    941

    Re: How do you calculate the hours between two dates excluding the weekends?

    =NETWORKDAYS(A1,B1-0.001)*24

    If you leave out the -.001 (or any miniscule, irrelevant fraction of a day) the defined function will include the the last day as a whole day, even though the time is exactly the same as the beginning time.

    Please advise if you intend to use times other than 12 midnight...
    Last edited by jhren; 08-03-2013 at 08:54 AM.

  3. #3
    Registered User
    Join Date
    06-18-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    27

    Re: How do you calculate the hours between two dates excluding the weekends?

    Yes, I'll also be using other times aside from 12 midnight... will the formula also be applicable to:

    A1: 06/06/2013 1:30 AM
    B1: 06/12/2013 1:30 AM

    oh by the way, the value needs to be in this format [h]:mm
    so it's 96:00

    * I tried your formula, it resulted to -48... please advise
    Last edited by Charoum; 08-03-2013 at 07:30 AM.

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

    Re: How do you calculate the hours between two dates excluding the weekends?

    Assuming that the dates won't be at weekends this version will use the times too

    =NETWORKDAYS(A1,B1)-1+MOD(B1,1)-MOD(A1,1)

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

  5. #5
    Registered User
    Join Date
    06-18-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    27

    Re: How do you calculate the hours between two dates excluding the weekends?

    Hi it works but I get ###### when A1 and B1 cells are blank, how do make it blank when there is nothing written on the A1 and B1 cells?

    Thank you so much

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: How do you calculate the hours between two dates excluding the weekends?

    You can make the formula apply only when both A1 and B1 are populated using this version

    =IF(COUNT(A1,B1)=2,NETWORKDAYS(A1,B1)-1+MOD(B1,1)-MOD(A1,1),"")

  7. #7
    Valued Forum Contributor AZ-XL's Avatar
    Join Date
    03-22-2013
    Location
    Azerbaijan, Baku
    MS-Off Ver
    Excel 2007
    Posts
    603

    Re: How do you calculate the hours between two dates excluding the weekends?

    What about this array formula. Formulas above are much more simpler and recommended to use.

    =((SUM(IF(WEEKDAY(ROW(INDIRECT(INT(A1)&":"&INT(A2))))>=6,0,1))-1)+(A2-INT(A2)-(A1-INT(A1))))*24 Ctrl+Shift+Enter
    Appreciate the help? CLICK *

+ 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: 13
    Last Post: 07-20-2016, 02:05 AM
  2. Replies: 4
    Last Post: 08-10-2012, 11:41 AM
  3. Replies: 7
    Last Post: 01-11-2011, 06:26 AM
  4. Replies: 3
    Last Post: 12-23-2010, 04:46 PM
  5. Calculate difference between dates excluding weekends
    By nitinjoshi123 in forum Excel General
    Replies: 15
    Last Post: 05-27-2008, 06:32 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