Written by Allen Wyatt (last updated September 7, 2022)
This tip applies to Excel 97, 2000, 2002, and 2003
Sunil can use the NETWORKDAYS function to return the number of regular business days between two dates. The function assumes that Saturday and Sunday are not work days, but in Sunil's organization only Sunday counts as a non-work day. He wonders if there is a way to use NETWORKDAYS and specify that only Sunday should be excluded from the count returned.
You can determine this by using a formula based on the NETWORKDAYS function. Assuming that the starting date is in A1 and the ending date is in B1, the following formula examines the days between the two dates and essentially return a count of non-Sunday days in that range:
=NETWORKDAYS(A1,B1)+SUMPRODUCT(--(WEEKDAY (ROW(INDIRECT(A1&":"&B1)))=7))
Of course, since Sundays are the only day of the week being excluded, you could simply skip the use of NETWORKDAYS and use SUMPRODUCT to figure out if the day should be counted or not:
=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1&":"&B1)))>1))
If you expect that there may be holidays in the range, and that those holidays are in the named range "holidays," then you'll need to go back to using NETWORKDAYS in the formula:
=NETWORKDAYS(A1,B1,holidays)+SUMPRODUCT(-- (WEEKDAY(ROW(INDIRECT(A1&":"&B1)))=7),-- (NOT(ISNUMBER(MATCH(ROW(INDIRECT(A1&":"&B1)) ,holidays,0)))))
Other variations of what constitutes the work days in a week have been covered by Chip Pearson at his site:
http://www.cpearson.com/excel/betternetworkdays.aspx
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (7093) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Specifying Different Weekends with NETWORKDAYS.
Create Custom Apps with VBA! Discover how to extend the capabilities of Office 365 applications with VBA programming. Written in clear terms and understandable language, the book includes systematic tutorials and contains both intermediate and advanced content for experienced VB developers. Designed to be comprehensive, the book addresses not just one Office application, but the entire Office suite. Check out Mastering VBA for Microsoft Office 365 today!
Excel makes working with a list of dates relatively easy. If you have a list of dates, you may need to know how many of ...
Discover MoreWork with times in a worksheet and you will eventually want to start working with elapsed times. Here's an explanation of ...
Discover MoreExcel allows you to perform quite a few operations using dates in your worksheet. Sometimes, however, the answer may not ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2018-08-10 14:41:59
Gokul G
Sir,
The formula does not work when the start and end date are of some reference.
(Ex A1 - Start Date , B1 - End Date and I receive A1 and B1 from other cell reference, say B2 and B3). I am getting an error - #Ref!
A1=B2
B1=B3
Could you please help me out here ?
Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2025 Sharon Parq Associates, Inc.
Comments