Microsoft KB Archive/61575

= Formula to Find Number of Weekdays Between Dates =

Article ID: 61575

Article Last Modified on 11/16/2006

-

APPLIES TO


 * Microsoft Excel 97 Standard Edition
 * Microsoft Excel 95 Standard Edition
 * Microsoft Excel 5.0 Standard Edition
 * Microsoft Excel 98 for Macintosh

-



This article was previously published under Q61575





SUMMARY
In Microsoft Excel version 4.0 and later, use the following formula to find the number of weekdays between two dates, where A1 equals the first date first date and A2 equals the second date:

  =NETWORKDAYS(A1,A2)

NOTE: The dates in A1 and A2 must be weekdays, or the result may not be correct.

In all versions of Microsoft Excel including version 4.0 the following formula can be used to get the same result as the NETWORKDAYS function:

  =A2-A1+1-INT((A2-A1+1)/7)*2-IF(INT((A2-A1+1)/7)=(A2- A1+1)/7,0,IF(WEEKDAY(A2)

MORE INFORMATION
The first part of the formula determines the total number of days between the two dates.

The next section determines the number or whole weeks between the two dates. This section then multiplies that by two because there is a Saturday and a Sunday in each whole week.

The last section determines if the range spanned a weekend even though it was not a whole week. For example, if your start date was on a Thursday, and your end date was on a Monday, there would be a weekend in between. The WEEKDAY function would return a 2 for Monday and a 5 for Thursday, so an additional two days are subtracted.

If you are using Microsoft Excel version 4.0 or later and the NETWORKDAYS function is not available, you must install the Analysis ToolPak add-in macro. For more information on managing ad-ins, see &quot;Managing Add-in Commands and Functions&quot; in Chapter 4 of the &quot;Microsoft Excel User's Guide 2.&quot;

Additional query words: 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.0 3.00 4.0 4.00 5.0 ATP Tool Pack ToolPack 97 98 XL98 XL97 XL7 XL5 XL4 XL3 XL

Keywords: KB61575

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.