As an alternative to Ekim's (and indirectly, Harlan Grove's) formulation, perhaps the following:
MrEC153.xls |
---|
|
---|
| A | B | C | D | E | F |
---|
1 | Start | Stop | "Workdays" | "Workdays" | | Holidays |
---|
2 | 12-Nov-03 | 19-Dec-03 | 31 | 31 | | 01-Jan-03 |
---|
3 | 17-Mar-03 | 27-Sep-03 | 164 | 164 | | 18-Apr-03 |
---|
4 | 01-Jan-03 | 11-Dec-03 | 289 | 289 | | 26-May-03 |
---|
5 | 01-Sep-03 | 17-Oct-03 | 40 | 40 | | 04-Jul-03 |
---|
6 | 03-Apr-03 | 16-Aug-03 | 114 | 114 | | 01-Sep-03 |
---|
7 | 23-Mar-03 | 07-Nov-03 | 193 | 193 | | 27-Nov-03 |
---|
8 | 15-Sep-03 | 31-Dec-03 | 90 | 90 | | 28-Nov-03 |
---|
9 | 27-Feb-03 | 28-May-03 | 76 | 76 | | 25-Dec-03 |
---|
10 | 01-Nov-03 | 31-Mar-04 | 126 | 126 | | 01-Jan-04 |
---|
|
---|
The formula in C2 is:
=NETWORKDAYS(A2,B2,Holidays)+INT(B2/7)-INT(A2/7)+INT(WEEKDAY(A2)/7)
while the formula in D2 is as posted in the reply immediately above.
I offer this alternative, since recently some experts on this board seem to be cautioning against the overuse of array formulations, and because I have long championed this alternative formulation. In short, the simplest, non-array oriented formula for counting the number of a particular weekday between any 2 dates (inclusive) is:
=INT((End-Wkday)/7)-INT((Start-Wkday)/7)+INT(WEEKDAY(Start-Wkday)/7)
where Start is the starting date of interest, End is the ending date, and Wkday = 1,2,3,4,5,6, or 7, for Sunday through Saturday, respectively. Note that Wkday can be omitted for
Saturday, so that the formula simplifies to:
=INT(Stop/7)-INT(Start/7)+INT(WEEKDAY(Start)/7)
when you want to count the number of Saturdays between any 2 dates. Note that either formula is considerably faster than alternative expressions that return the same answer, such as:
=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(Start&":"&End)))=Wkday))
when dealing with large numbers of calculations. See also:
http://www.mrexcel.com/board2/viewtopic.php?t=61643
http://www.mrexcel.com/board2/viewtopic.php?t=63010
http://www.mrexcel.com/board2/viewtopic.php?t=67153
--Tom McClain