Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Specifying Different Weekends with NETWORKDAYS.

Specifying Different Weekends with NETWORKDAYS

Written by Allen Wyatt (last updated September 7, 2022)
This tip applies to Excel 97, 2000, 2002, and 2003


1

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.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Making Text Bold

Want a cool shortcut to make your text bold? Here's a method that fits in wonderfully with how things are done in the ...

Discover More

Deleting MRU Entries

By default Word dutifully keeps track of the different files you've worked on in the past. If you want to delete an entry ...

Discover More

Using Older Spelling and Grammar Checking

If you prefer the older spelling and grammar checking process used in Word, then you will find this tip helpful. It only ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More ExcelTips (menu)

Unique Date Displays

Need to print an elapsed date in a strange format? It's easier to do than may appear at first glance. Here's a discussion ...

Discover More

Using the EOMONTH Function

If you need to determine the date of the last day in a month, it's hard to beat the flexibility of the EOMONTH function. ...

Discover More

Calculating Business Days

There are calendar days and then there are business days. Excel provides the NETWORKDAYS function that is helpful to ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is four minus 0?

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 ?


This Site

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.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.