This short tutorial explains the use of Excel NETWORKDAYS and WORKDAY functions to calculate workdays with custom weekend parameters and holidays.
Microsoft Excel provides two functions specially designed for calculating weekdays - WORKDAY and NETWORKDAYS.
The WORKDAY function returns a date N working days in the future or in the past and you can use it to add or subtract workdays to a given date.
Using the NETWORKDAYS function, you can calculate the number of workdays between two dates that you specify.
In Excel 2010 and higher, more powerful modifications of the above-said functions are available, WORKDAY.INTL and NETWORKDAYS.INTL, which let you define which and how many days are weekend days.
And now, let's have a closer look at each function and see how you can use it to calculate working days in your Excel worksheets.
Excel WORKDAY function
The Excel WORKDAY function returns a date that is a given number of working days ahead of or prior to the start date. It excludes weekends as well as any holidays you specify.
The WORKDAY function is purposed for calculating workdays, milestones and due dates based on the standard working calendar, with Saturday and Sunday being the weekend days.
WORKDAY is a built-in function in Excel 2007 - 365. In earlier versions, you need to enable the Analysis ToolPak.
When using WORKDAY in Excel, you have to input the following arguments:
The first 2 arguments are required and the last one is optional:
- Start_date - the date from which to start counting weekdays.
- Days - the number of workdays to add to / subtract from start_date. A positive number returns a future date, a negative number returns a past date.
- Holidays - an optional list of dates that should not to be counted as working days. This can be either a range of cells containing the dates you want to exclude from calculations, or an array constant of the serial numbers representing the dates.
Now that you know the basics, let's see how you can use the WORKDAY function in your Excel worksheets.
How to use WORKDAY to add / subtract business days to date
To calculate workdays in Excel, follow these simple rules:
- To add workdays, enter a positive number as the days argument of a WORKDAY formula.
- To subtract workdays, use a negative number in the days argument.
Supposing you have a start date in cell A2, a list of holidays in cells B2:B5, and you want to find out the dates 30 workdays in the future and past. You can do this using the following formulas:
To add 30 workdays to the start date, excluding holidays in B2:B5:
=WORKDAY(A2, 30, B2:B5)
To subtract 30 workdays from the start date, excluding holidays in B2:B5:
=WORKDAY(A2, -30, B2:B5)
To calculate weekdays based on the current date, use the TODAY() function as the start date:
To add 30 workdays to today's date:
=WORKDAY(TODAY(), 30)
To subtract 30 workdays from today's date:
=WORKDAY(TODAY(), -30)
To supply the start date directly to the the formula, use the DATE function:
=WORKDAY(DATE(2015,5,6), 30)
The following screenshot demonstrates the results of all these and a few more WORKDAY formulas:
And naturally, you can enter the number of workdays to add to / subtract from the start date in some cell, and then refer to that cell in your formula. For example:
=WORKDAY(A2, C2)
Where A2 is the start date and C2 is the number of non-weekend days behind (negative numbers) or ahead of (positive numbers) the start date, no holidays to exclude.
Tip. In Excel 365 and 2021, you can use WORKDAY in combination with SEQUENCE to generate a series of working days.
Excel WORKDAY.INTL function
WORKDAY.INTL is a more powerful modification of the WORKDAY function that works with custom weekend parameters. As well as WORKDAY, it returns a date that is a specified number of workdays in the future or in the past, but lets you determine which days of the week should be considered weekend days.
The WORKDAY.INTL function was introduced in Excel 2010 and so is not available in earlier Excel versions.
The syntax of the Excel WORKDAY.INTL function is as follows:
The first two arguments are required and are akin to WORKDAY's:
Start_date - the initial date.
Days - the number of working days before (negative value) or after (positive value) the start date. If the days
argument is supplied as a decimal number, it is truncated to the integer.
The last two arguments are optional:
Weekend - specifies which weekdays should be counted as weekend days. This can be either a number or a string, as demonstrated below.
Number | Weekend days |
1 or omitted | Saturday, Sunday |
2 | Sunday, Monday |
3 | Monday, Tuesday |
4 | Tuesday, Wednesday |
5 | Wednesday, Thursday |
6 | Thursday, Friday |
7 | Friday, Saturday |
11 | Sunday only |
12 | Monday only |
13 | Tuesday only |
14 | Wednesday only |
15 | Thursday only |
16 | Friday only |
17 | Saturday only |
Weekend string - a series of seven 0's and 1's that represent seven days of the week, beginning with Monday. 1 represents a non-working day and 0 represents a workday. For example:
- "0000011" - Saturday and Sunday are weekends.
- "1000001" - Monday and Sunday are weekends.
At first sight, weekend strings may seem superfluous, but I personally like this method better because you can make a weekend string on the fly without having to remember any numbers.
Holidays - an optional list of dates you want to exclude from the working day calendar. This can be a range of cells containing the dates, or an array constant of the serial values representing those dates.
Using WORKDAY.INTL in Excel - formula examples
Well, the pretty big bulk of theory we've just discussed may seem quite complicated and confusing, but trying your hand at formulas will make things really easy.
On our dataset, with the start date in cell A2 and a list of holidays in A5:A8, let's calculate workdays with custom weekends.
To add 30 workdays to the start date, Friday and Saturday counted as weekends and holidays in A5:A8 excluded:
=WORKDAY.INTL(A2, 30, 7, A5:A8)
or
=WORKDAY.INTL(A2, 30, "0000110", A5:A8)
To subtract 30 workdays from the start date, Sunday and Monday counted as weekends and holidays in A5:A8 excluded:
=WORKDAY.INTL(A2, -30, 2, A5:A8)
or
=WORKDAY.INTL(A2, -30, "1000001", A5:A8)
To add 10 workdays to the current date, Sunday being the only weekend day, no holidays:
=WORKDAY.INTL(TODAY(), 10, 11)
or
=WORKDAY.INTL(A2, 10, "0000001")
In your Excel sheet, the formulas may look similar to this:
Note. Both Excel WORKDAY and WORKDAY.INTL functions return serial numbers representing the dates. To get those numbers displayed as dates, select the cells with the numbers and press Ctrl+1 to open the Format Cells dialog. On the Number tab, select Date in the Category list, and choose the date format you want. For the detailed steps, please see How to change date format in Excel.
Excel WORKDAY and WORKDAY.INTL errors
If your Excel WORKDAY or WORKDAY.INTL formula returns an error, the reason is likely to be one of the following:
#NUM! error occurs if either:
- a combination of the
start_date
anddays
arguments results in an invalid date, or weekend
argument in the WORKDAY.INTL function is invalid.
#VALUE! error occurs if either:
start_date
or any value inholidays
is not a valid date, ordays
argument is non-numeric.
Excel NETWORKDAYS function
The NETWORKDAYS function in Excel returns the number of workdays between two dates, excluding weekends and, optionally, the holidays you specify.
The syntax of Excel NETWORKDAYS is intuitive and easy-to-remember:
The first two arguments are obligatory and the third one is optional:
- Start_date - initial date from which to start counting working days.
- End_date - the end of the period for which you are counting workdays.
Both the start date and end date are counted in the returned number of workdays.
- Holidays - an optional list of holidays that should not to be counted as work days.
How to use NETWORKDAYS in Excel - formula example
Let's say you have a list of holidays in cells A2:A5, start dates in column B, end dates in column C, and you want to know how many workdays are between these dates. The appropriate NETWORKDAYS formula is easy to figure out:
=NETWORKDAYS(B2, C2, $A$2:$A$5)
Notice that the Excel NETWORKDAYS function returns a positive value when the start date is less than the end date, and a negative value if the end date is more recent than the start date (as in row 5):
Excel NETWORKDAYS.INTL function
Like NETWORKDAYS, Excel's NETWORKDAYS.INTL function calculates the number of weekdays between two dates, but lets you specify which days should be counted as weekend days.
The syntax of the NETWORKDAYS.INTL function is very similar to NETWORKDAYS', except it has the additional [weekend] parameter that indicates which days of the week should be counted as weekends.
The weekend
argument can accept either a number or a string. The numbers and weekend strings are exactly the same as in the weekend
parameter of the WORKDAY.INTL function.
The NETWORKDAYS.INTL function is available in Excel 365 - 2010.
Using NETWORKDAYS.INTL in Excel - formula example
Using the list of dates from the previous example, let's calculate the number of workdays between two dates with Sunday being the only weekend day. For this, you type number 11 in the weekend
argument of your NETWORKDAYS.INTL formula or make a string of six 0's and one 1 ("0000001"):
=NETWORKDAYS.INTL(B2, C2, 11, $A$2:$A$5)
Or
=NETWORKDAYS.INTL(B2, C2, "0000001", $A$2:$A$5)
The following screenshot proves that both formulas return absolutely identical results.
How to highlight workdays in Excel
Using the WORKDAY and WORKDAY.INTL functions, you can not only calculate workdays in your Excel worksheets but also highlight them as your business logic requires. For this, you create a conditional formatting rule with either a WORKDAY or WORKDAY.INTL formula.
For example, in a list of dates in column B, let's highlight only future dates that are within 15 workdays from today's date, excluding two holidays in cells A2:A3. The most obvious formula that comes to mind is as follows:
=AND($B2>TODAY(), $B2<=WORKDAY(TODAY(), 15, $A$2:$A$3))
The first part of the logical test cuts off past dates, i.e. you check if a date is equal to or greater than today: $B2>TODAY(). And in the second part, you verify whether a date is no more than 15 weekdays in the future, excluding the weekend days and specified holidays: $B2<=WORKDAY(TODAY(), 15, $A$2:$A$3)
The formula looks correct, but once you create a rule based on it, you will realize that it highlights wrong dates:
Let's try to figure out why that happens. The problem is not with the WORKDAY function, as someone may conclude. The function is right, but... what does it actually do? It returns a date 15 workdays from now, excluding weekend days (Saturday and Sunday) and holidays in cells A2:A3.
Okay, and what does the rule based on this formula do? It highlights ALL the dates that are equal to or greater than today and less than the date returned by the WORKDAY function. You see? All the dates! If you don't want to color the weekends and holidays, then you need to explicitly tell Excel not to. So, we are adding two more conditions to our formula:
- The WEEKDAY function to exclude weekends: WEEKDAY($B2, 2)<6
- The COUNTIF function to exclude holidays: COUNTIF($A$2:$A$3, $B2)=0
As demonstrated in the below screenshot, the improved formula works perfectly:
=AND($B2>TODAY(), $B2<=WORKDAY(TODAY(), 15, $A$2:$A$3), COUNTIF($A$2:$A$3, $B2)=0, WEEKDAY($B2, 2)<6)
As you see, the WORKDAY and WORKDAY.INTL functions make calculating workdays in Excel quick and easy. Of course, your real-life formulas are likely to be more sophisticated, but knowing the basics helps immensely, because you can remember only a small set of essential things and derive the rest. I thank you for reading and hope to see on our blog next week!
170 comments
Hi,
I need to calculate days a sample is overdue, and networkdays -1 works just fine unless the sample is approved on a weekend day. For example, a sample is due on Friday, and is approved on Saturday or Sunday. Just using NETWORKDAYS(W2,P2,)-1,0) returns 0 days late. But I need it to be 1, since technically it is approved after the due date. Any ideas?
Thank you for any help!
Hello,
If I understand your task correctly, please try the following formula:
=IF(AND((NETWORKDAYS(W2,P2)-1)=0,P2>W2),1,NETWORKDAYS(W2,P2)-1)
Hope this will help you!
Hi Dear,
10/10/2017 is my last work day. I need to calculate total day has worked.(from 1-10th). however, I need to exclude weekend and Public holiday. what formula I should use?
I think I figured it out:
=A1+IF(WEEKDAY(A1)=1,3,IF(WEEKDAY(A1)=2,3,IF(WEEKDAY(A1)=3,3,IF(WEEKDAY(A1)=4,5,IF(WEEKDAY(A1)=5,5,IF(WEEKDAY(A1)=6,5,4))))))
Any feedback?!
Hello,
I need a formula to add 3 days to my below date and time and exclude weekend:
16-08-2017 10:00
Any idea? workday formula just adds 3 days and make the time 12 A.M. and does not consider the time.
Regards,
A
I have two dates
start date : 16-08-2017 10:00
end date : 25-08-2017 : 18:00
the work timings are from 09:00 to 18:00 hrs.
The NETWORKDAY(start_day, end_date, list_of_aug_weekends) is returning me exactly 8 days which is correct. multiply it by 8, will get 64 hours. but can any one please help me with a formulae on getting 63 hours.
Thanks
I like to remove the holidays. How would I get the end date? If I would give you give you the start date and the number of working days.
Yeah I said it but I didn't get the answer or formula for it. Thanks
I like to remove the holidays. How would I get the end date? If I would give you give you the start date and the number of working days.
Sir/Madam,
I want to format an excel sheet, need the result of number of working days by providing start date and end date.but the number of working days is 6 instead of 5. i tried with =networkdays, it is calculating 5 days per week.
this is for my company, to prepare the planning schedule. so, here 6 days per week and add all the national holidays in holidays list.
it would be great, if you can guide me, first to set a calendar with all national holidays and all Fridays as leave. then if i make a schedule with refer this calendar, then we can prepare the correct schedule with proper working days.
thank you
Thank you so much for this explanation, it helped a lot! I am using the WORKDAY function and want to include holidays. What if you want to select multiple columns with holidays, for example column B and column C? Is it possible to add this to the formula?
Good day to you all, I need help please.
Given the durations, I wanted to indicate the start and finish dates of each activity with the following conditions.
Assuming start of first activity on 07 July 2017
Start hour - 8:00AM
End Working hour per day - 18:00
Sunday and Holiday - No work.
Hope to receive your support guys. Thanks in advance.
Hi,
can I use 0000000 to make all days workdays?
If not how can do so? I have been trying to crate a formula to calculate only holidays without weekends.
Pls help ASAP.
how would i include weekends and exclude holidays between 2 date time values (in order to find the total hours)?
If you want to count all days but holidays, you can use DATE and then subtract the number of holidays.
But if you have the list of holiday dates, the formula can be modified with COUNTIFS:
=(DATEDIF(F1,F2,"d")-COUNTIFS(E1:E14,">="&F1,E1:E14,"<="&F2))*24
where F1 - start date, F2 – end date, E1:E14 - holiday dates list.
Hi, Please tell me how could I add Saturday as working day and remove holidays. I want to use networkdays or workday formula.
Hi, can anyone please tell me how I can add calendar days excluding bank holidays to a date in excel?
For example, if todays date is 16 feb 2017 and I want to add 90 calendar days excluding the bank holidays on 14&17 April and 1 May the date returned should be 19 May 2017.
Thanks in Advance
Is there a way to have the number of days worked show as 0 until and end date has been entered using the networkdays.intl formula. I know the start dates for my projects but the end dates are not know until the jobs are finaled.
Hi
Assume working 11:15 hours/day and 17 days/month,since i'm beginner in excel I use this simple formula(17*11.25) to get the result,but the result is shown in decimal.I want to display result in time hh:mm format.
I need assistance and I don't find a way to eliminate 30536 when I use formula eg. Networkdays(B$2,today())and format as number its display 30536 if there is no date on cell B2. So how to make display zero for instance when there is no value on cell B2?
Thanks
Bapsy
I need some assistance. I am creating a spreadsheet to calculate budgetary allowance on a daily basis. I have successfully set it using the following formula:
A1= Monthly Budget for a given Expense account.
=A1/(EOMONTH(TODAY(),0)-TODAY())
I have just been informed since this is for work, it must exclude weekends. Please advise how to achieve this.
i need a function to get the Actual Number of days providing Working Days
example:
Suppose the Working Days = 5 so the actual Number f days should be 7 because there is two days weekend
another example :
suppose working days = 10 so the actual number of days should be 14 because there are 4 days weekend
so my question i need equation to calculate actual number of days when i entered the working days
Hi!
I ve found your tutorial very interresting. Right now I'm trying to dispay days of a month per week(a table for each week(from monday to sunday) of the month.
A separate table for each week dispalying the day and the date with a title for each week(week from .... To ...).
Hope someone can help.