+ Reply to Thread
Results 1 to 4 of 4

Calculate the number of days between dates (excluding weekends)

  1. #1
    Forum Contributor
    Join Date
    03-19-2016
    Location
    Chicago, IL
    MS-Off Ver
    Office 2016 Professional
    Posts
    388

    Calculate the number of days between dates (excluding weekends)

    How do I subtract two dates, using the work week (excluding weekends and/or holidays (if possible)?

    When either date is blank, default in N/A

    Column A Column B Column C
    Date 1 Date 2 Expected Result:
    12/02/19 12/04/19 2
    _______ ___________ N/A
    11/21/19 11/25/19 2 (this example has a weekend). I am counting 11/2/19 as Day 0

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,995

    Re: Calculate the number of days between dates (excluding weekends)

    Look up the NETWORKDAYS function, which is built-in and does everything you are asking for.

    You will have to add a little wrapper for the N/A.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    03-19-2016
    Location
    Chicago, IL
    MS-Off Ver
    Office 2016 Professional
    Posts
    388

    Re: Calculate the number of days between dates (excluding weekends)

    Yes, I have reviewed that formula and am seeing unexpected results:

    =NETWORKDAYS(B2,A2)

    When there are no dates, I need that to have an 'N/'A value to differentiate these. There are some situations where one date is present but the not other - I still want that to be a 'N/A'
    One other adjustment. If the date is illogical - meaning the result of the calculation is a - (negative) date, output a N/A. This happens when Column B is more recent than Column Column A.

    Column A Column B Column C
    Date1: Date 2: Current Result:

    ________ _________ 0 (expecting this to be N/A)
    3/16/2019 3/16/2019 0 (this is a weekend date - I agree with a result of '0')
    4/16/2019 4/16/2019 1 (Why is this a value of '1'?)
    12/5/2018 12/3/2018 3 (Expecting a value of '2').
    10/7/2019 10/9/2019 -3 (illogical - can this defaulted to N/A?)

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,995

    Re: Calculate the number of days between dates (excluding weekends)

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    4/16/2019 4/16/2019 1 (Why is this a value of '1'?)
    Because if you start something on 4/16 and finish on 4/16 it took you one day (not zero days). For your purposes you may need to subtract 1 from your result.

    You also need to set up a list of holidays and add the third argument.

+ 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. Add fixed number of days, including weekends, but excluding a range of dates
    By clownfishcoxy in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 07-25-2019, 06:21 AM
  2. Calculate days using DateTime Picker excluding weekends and dispaly dates column wise
    By bhuvana86 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-28-2015, 02:10 PM
  3. Replies: 7
    Last Post: 06-19-2013, 05:45 AM
  4. Calculate number of days excluding holidays and weekends
    By david1987 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-05-2012, 08:17 AM
  5. Calculate number of days, excluding weekends and holidays
    By cloyd in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-26-2012, 04:37 PM
  6. number of days between dates excluding weekends
    By jimmy@9830 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-25-2008, 03:26 PM
  7. Calculate number of business days excluding weekends and holidays?
    By sethi85 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-07-2007, 02:11 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