Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Calculating Business Days.

Calculating Business Days

Written by Allen Wyatt (last updated February 4, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021


3

In performing calculations with Excel, it is often helpful to know how many days there are between two dates. Excel makes this easy—you just subtract the earlier date from the latter.

In a business environment, however, you may not want to know just the number of days—you probably want to know the number of business days between two dates. In other words, how many workdays are there between two dates?

Believe it or not, Excel makes it almost as easy to calculate business days as it is to calculate regular days. All you need to do is use the NETWORKDAYS worksheet function. Let's suppose for a moment that you had two dates: one in A3 and the other in A4. The date in A3 is your starting date and the date in A4 is the ending date. To calculate the work days between the two dates, you could use the following formula:

=NETWORKDAYS(A3,A4)

This returns a count of all the days between the two dates, not counting weekends. You should note that the function returns the number of full days. Thus, if your starting date was Sept. 4 and your ending date was Sept. 5, the function would return a value of 2. (Provided neither day was a weekend day.)

If you want to account for holidays, the easiest way is to enter your standard holidays in a range of cells, and then define a name for that range. (I always like the terribly obvious name of “Holidays.”) You can then alter the NETWORKDAYS formula in this manner:

=NETWORKDAYS(A3,A4,Holidays)

Microsoft also introduced an expanded version of the NETWORKDAYS function in Excel 2010, but it has a different function name: NETWORKDAYS.INTL. The biggest difference between NETWORKDAYS.INTL and NETWORKDAYS is that NETWORKDAYS.INTL allows you to specify how the function should handle weekends. This new parameter goes right after the ending date parameter. So, for instance, if you wanted to know the number of work business days between the dates in A3 and A4 and you wanted to take holidays into account, you would use something like the following:

=NETWORKDAYS.INTL(A3,A4,1,Holidays)

Note the addition of the "1" parameter in the third parameter position. The value you use here can be any of 14 values:

Number Weekend Days
1 Saturday, Sunday
2 Sunday, Monday
3 Monday, Tuesday
4 Tuesday, Wednesday
5 Wednesday, Thursday
6 Thursday, Friday
7 Friday, Saturday
11 Sunday
12 Monday
13 Tuesday
14 Wednesday
15 Thursday
16 Friday
17 Saturday

If that isn't flexible enough for you, NETWORKDAYS.INTL allows you to use a string for the third parameter that exactly specifies which days should be considered workdays and weekend days. So, for instance, let's say that your company uses a four-day workweek, Monday through Thursday. In this case, you could use a formula such as the following:

=NETWORKDAYS.INTL(A3,A4,"0000111",Holidays)

Note that the string in the third parameter position is exactly 7 digits long and represents the days of the week, Monday through Sunday. A 0 indicates that day is a workday and a 1 indicates it is a "weekend" day that should not be used in calculations.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12401) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. You can find a version of this tip for the older menu interface of Excel here: Calculating Business Days.

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

Protecting Formulas in Control-Linked Cells

Form controls can be a great way to get information into a worksheet. They are designed to be linked to a cell so that ...

Discover More

Making Ignore All Work for a Document on All Systems

When you tell Word's spell checker to ignore all instances of a misspelling, you may expect that the misspelling will be ...

Discover More

Generating Unique Numbers for Worksheets

You may need to automatically generate unique numbers when you create new worksheets in a workbook. Here are a couple of ...

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 (ribbon)

Calculating the First Tuesday

Do you need to figure out the date for the first Tuesday of any given month? Excel is incredibly flexible when it comes ...

Discover More

Finding the Dates for Minimums and Maximums

If you use Excel to maintain a collection of data, you may need to find information in one column based on information in ...

Discover More

Date for Next Wednesday

When working with dates, it is often helpful to be able to calculate some date in the future based on a starting date. ...

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 two more than 7?

2023-02-06 18:17:08

Tomek

Bob:
Further to my earlier comment:
The macro below will automatically find the end date you wanted, then adjust the date to not fall on a weekend or holiday.

For the purposes of the macro I created named ranges:
(see Figure 1 below)
Target = A2 - that is where you put desired number of workdays. I added this to the sheet so that you can change the number of workdays without changing the macro code.
Start = A3 - your start date
End = A4 - you can put any date there, the macro will adjust it to your burnout date.

Once you put your start date and number of workdays run the macro. If the resulting end date is not a workday, it will ask you if you want to adjust it.

--------------------
Sub FinalDate()

    DesiredDays = Range("Target").Value
    
    Range("A5").GoalSeek Goal:=DesiredDays, ChangingCell:=Range("End")
    Dim cl As Range
    Set cl = Range("End")
    If Weekday(cl) = vbSaturday Or Weekday(cl) = vbSunday Or Range("hd") = "Holiday" Then
    
        continue = MsgBox("End date is on weekend or holiday." & vbCr & "Adjust the date?", vbYesNo, "Adjust?")
        If continue = vbYes Then
            Do
                cl.Value = cl.Value - 1
            Loop While Weekday(cl) = vbSaturday Or Weekday(cl) = vbSunday Or Range("hd") = "Holiday"
        End If
    End If
End Sub

Figure 1. 


2023-02-06 17:51:27

Tomek

Bob:
An Excel formula may be a bit complicated for what you need, as there would need to be a circular reference between the end date and Holidays. But there is a way to get what you need:

Use one of the formulas Allen suggested, e.g., =NETWORKDAYS(A3,A4,Holidays) say in the cell A5. Put your start date in cell A3, and any date in cell A4.
Then use the a functionality of Excel called Goal Seek. (Data tab - Forecast Group - What-If-Analysis -Goal Seek). (see Figure 1 below) for what to enter in the fields.

Once you click OK you will get a solution. (see Figure 2 below)

Note that I have a range named Holidays in my spreadsheet, as Allen suggested.

There is a quirk in how the process operates, because the target date found may actually be on a weekend or on a holiday, which technically will be correct, but not necessarily what you want. See, the process uses an algorithm, that is similar to trial and error, and once it finds the date that satisfies the value in the target cell, it does not look any further. This can be relatively easily corrected by manually adjusting the date to an earlier date just before the weekend or holiday (it should result in the same number of workdays). To aid in it, you can format the end date to show the weekday, and add an indicator for holiday in a cell beside it. the formula for the latter could be:

=IF(ISNA(MATCH(A4,Holidays,0)),"Not Holiday","Holiday")

See the figures.

It is worth remembering that the workdays function doesn't count the start day, so if the starting day is today and the end day is tomorrow, it will only return 1 day not 2.

If you need to do this often, you can create a macro to automate both the Goal Seek and the date adjustment. I will post a macro suggestion separately.

Figure 1. 

Figure 2. 


2023-02-04 15:27:10

Bob Houghton

If I have a start date, and know there are 42 workdays left for a worker, is there a formula that would tell be the burnout date taking into consideration of the weekend days?


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu 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.