Excel 2024: Calculate Nonstandard Work Weeks


June 25, 2024 - by

Excel 2024: Calculate Nonstandard Work Weeks

In my live Power Excel seminars, it is pretty early in the day when I show how to right-click the Fill Handle, drag a date, and then choose Fill Weekdays. This fills Monday through Friday dates. I ask the audience, "How many of you work Monday through Friday?" A lot of hands go up. I say, That's great. For everyone else, Microsoft clearly doesn't care about you. Laughter.

It certainly seems that if you work anything other than Monday through Friday or have a year ending any day other than December 31, a lot of things in Excel don't work very well.

However, two functions in Excel show that the Excel team does care about people who work odd work weeks: NETWORKDAYS.INTL and WORKDAY.INTL.


But let's start with their original Monday-Friday antecedents. The following figure shows a start date in column B and an end date in column C. If you subtract =C5-B5, you will get the number of days between the two dates. To figure out the number of weekdays, you use =NETWORKDAYS(B2,C2).

Note

If you subtract Monday August 14 from Friday August 18, Excel will tell you that there are 4 days between the two dates. Excel does not count the end date. But, NETWORKDAYS counts both the first and last date in the range.

It gets even better. NETWORKDAYS allows for an optional third argument where you specify work holidays. In the next figure, the list of holidays in H2:H13 allows the Work Days Less Holidays calculation in column F.

In Excel 2007, Microsoft added INTL versions of both functions with a new Weekend argument. This argument allowed for any two consecutive days as the weekend and also allowed for a one-day weekend.

However, there are still cases where the weekend does not meet any of the 14 weekend definitions added in Excel 2007.

For example, in northeast Ohio, the Hartville Marketplace is open Monday, Thursday, Friday, and Saturday. That means their weekend is Tuesday, Wednesday, and Sunday.

Starting in Excel 2010, in addition to using 1-7 or 11-17 as the weekend argument, you can pass 7-digit binary text to indicate whether a company is open or closed on a particular day. It seems a bit unusual, but you use a 1 to indicate that the store is closed for the weekend and a 0 to indicate that the store is open. After all, 1 normally means On and 0 normally means Off. But the name of the argument is Weekend, so 1 means it is a day off, and 0 means you don't have the day off.

Thus, for the Monday, Thursday, Friday, Saturday schedule at the Hartville Marketplace, you would use "0110001". Every time I type one of these text strings, I have to silently say in my head, "Monday, Tuesday, Wednesday" as I type each digit.

Marion Coblentz at the Hartville Marketplace could use the following formula to figure out how many Marketplace days there are between two dates.

By the way, I did not use the optional Holidays argument above because Memorial Day, July 4, and Labor Day are the biggest customer days in Hartville.

If you are ever in northeastern Ohio, you need to stop by Hartville to see the 100% American-Made house inside of the Hartville Hardware and to try the great food at the Hartville Kitchen.

Bonus Tip: Use WORKDAY.INTL for a Work Calendar

While NETWORKDAYS calculates the work days between two dates, the WORKDAY function takes a starting date and a number of days, and it calculates the date that is a certain number of work days away.

One common use is to calculate the next work day. In the following figure, the start date is the date on the previous row. The number of days is always 1. To generate a class schedule that meets on Monday, Wednesday, and Friday, specify a weekend of "0101011".




This article is an excerpt from MrExcel 2024 Igniting Excel

Title photo by Marissa Grootes on Unsplash