There are a number of functions in Excel to make operations simpler, easier, and speedy. Today we are going to show you how to use the WORKDAY function in Excel. For the session, we are using Excel 365, you can use your preferred version (at least Excel 2003).
The WORKDAY function can be used for generating future or past working days. Without further ado, let’s get to know about the function.
Introduction to WORKDAY Function in Excel
The WORKDAY function is categorized under the Date & Time functions. It returns a date that is in working days in the future or the past.
Summary:
Returns the serial number of the date before or after a specified number of workdays.
Syntax:
WORKDAY(start_day,days,[holidays])
Arguments:
Argument | Required/Optional | Explanation |
---|---|---|
start_date | Required | The date from which to start |
days | Required | The working days before or after start_date. Positive numbers for future dates, negative for past dates |
holidays | Optional | A list of dates that should be considered non-work days |
Version:
Workable from Excel version Excel 2003.
How to Use WORKDAY Function in Excel: 7 Examples
The WORKDAY function can be used in various operations. Let’s see some of them.
1. Generate a Sequence of Workdays
We can generate a sequence of workdays using the WORKDAY function. The following are the steps to do that.
- First, insert a date in cell B5. We will generate the sequence of working days from this date.
- The generic formula for our task will be
=WORKDAY(date,1)
- We want a consecutive sequence so we are going to use 1 in the days field.
- Let’s write the formula in Excel.
=WORKDAY(B5,1)
- Using the formula we have found the next working date. We have used Cell Reference in the formula.
- Keep copying the formula to find the sequence you want.
- We can also generate the weekdays of the working days using the following formula.
=TEXT(WEEKDAY(B5,1),"ddddd")
- Notice that after Friday it has generated Monday. The WORKDAY function generally identifies Saturday and Sunday as weekends (the US form). So, it returned Monday to Friday and then repeated.
2. Generate Workdays After Given Days
We can generate workdays from a date after any certain number of given days.
Let’s have a few dates and the number of days that denote the working day we are searching for from the given date.
- Since we have two inputs, start date, and number of days our formula will be:
- Write the formula in Excel.
=WORKDAY(B5,C5)
- We have written the formula using Cell Reference. You can see our start date was 02-Jul-2021 and the number of days was 4. Our result is 08-Jul-2021.
- You can see the difference between the two dates, they are not 4. As the name suggests, WORKDAY only produces working days of a week; it discards Saturday and Sunday from working days.
- Copy the formula for the rest of the values.
3. Generate Next Working Days
We can also produce the next working day from a date using the WORKDAY function.
To show you examples, let’s have a few days. From these dates, we will find the next workday.
- To find the next date we need to use 1 in our days field.
- Write the formula in Excel.
=WORKDAY(B5,1)
- We have found the next workdays from the provided date.
- Do the same for the rest of the values.
4. Find Working Days in Excel Excluding Weekends and Holidays
Previously we have seen how to generate the next working day, to keep things more advanced we can produce the next working day comparing holidays.
- We have introduced a list of holidays to our dataset. The holidays are listed in B12:B14.
- Our aim is if any of the derived date WORKDAY(start_date,1) matches in the holidays list that day will be eliminated from the working day and search for another workday.
- The formula will be something like below
- Write the formula in Excel.
=WORKDAY(B5,7,$B$12:$B$14)
- We have found the next working date. Since we are using a similar dataset in the previous section, you can see that the result has been changed.
- Earlier for 02-07-2021, our next working day was 05-07-2021, but now 05-07-2021 is the Holidays, and that’s why it was not counted as a workday. We have found 06-07-2021 as the next working day after 02-07-2021.
- Do the same for the rest of the values.
- You can see Holidays have an impact on the next working date.
- Last two examples we have derived the very next working day, if you need after a certain amount just change the values of the days parameter. (In the above image we found the 7th working day)
Read More: How to Calculate Working Days in Excel Excluding Weekends and Holidays
5. Check Whether a Day Is a Holiday or a Working Day
You can check whether a day is a holiday or a working day using the WORKDAY function.
- To check we need to apply a condition statement. The IF function will be helpful for condition checks.
- Our formula will be
=IF(WORKDAY(B5-1,1,$B$15:$B$17)=B5,"Working Day","Holiday")
- We are using date-1 in the start_day field of WORKDAY so that the function can eventually return that very date.
- Then we have checked the derived date from our given date. If they match we set it to return Working Day, Holiday otherwise.
- Here 01-07-2021 was listed in the Holidays. And our formula identified it as a holiday. Do the same for the rest of the values.
We have instructed you to write the formula just to perform the practice. The more you practice the more skillful you will be.
6. Excel WORKDAY Function with Hours
In this example, we will see how to use the WORKDAY function in Exel to consider hours to get the end time after a certain time from a starting moment.
- To do that, you have to specify Start Time, Total Hours, Office Hours, and Holidays (if any). We have specified all these in the following dataset.
- Now apply the following formula in the End Time cell:
=WORKDAY(B5,INT(C5/8)+IF(TIME(HOUR(C5),MINUTE(C5),SECOND(C5))+TIME(MOD(C5,8),MOD(MOD(C5,8),1)*60,0)>
G6,1,0),$I$5:$I$5)+IF(TIME(HOUR(B5),MINUTE(B5),SECOND(B5))+TIME(MOD(C5,8),MOD(MOD(C5,8),1)*60,0)>G6,F6
+TIME(HOUR(B5),MINUTE(B5),SECOND(B5))+TIME(MOD(C5,8),MOD(MOD(C5,8),1)*60,0)-G6,TIME(HOUR(B5),MINUTE(B5),SECOND(B5))
+TIME(MOD(C5,8),MOD(MOD(C5,8),1)*60,0))
Credit goes to extendoffice for this formula.
- You will get to see the result immediately.
7. Combine RANDBETWEEN Function with WORKDAY to Generate Random Working Days Between Two Days
Lastly, if you want to generate some random working days between two given dates, it’s also possible with the help of WORKDAY and RANDBETWEEN functions.
- Just use the following formula once to get a random working day.
=WORKDAY(RANDBETWEEN($B$5,$C$5)-2,1,$E$5)
- Copy the formula as per your wish how many times to copy it.
Read More: How to Calculate Working Days between Two Dates in Excel
Quick Notes
You need to keep several things in mind while using any function, so do for WORKDAY, here are some honorable mentions.
- Ways to Insert Dates in WORKDAY
You can insert dates in WORKDAY in various ways. Previously we have provided dates using Cell Reference.Â
â™ You can input your dates directly as in the image below.
=WORKDAY("3-08-2021",1)
We have inserted the date. You might have understood the reason for using 1. Yes, we are aiming to produce the next day.
â™ You can input the date using the DATE function.
=WORKDAY(DATE(2021,3,8),7)
We have used DATE inside the WORKDAY function. This time we are aiming for the 7th working day from the given date.
â™ If you want to find the next ( or any other, change the day value) working day from the current day, feel free to use the TODAY function.
The TODAY function returns the present-day dynamically in Excel.
=WORKDAY(TODAY(),10)
We have inserted the TODAY function within WORKDAY. And 10 in the days parameter. it returned our desired future work date (see the image below).
We are creating this article on 3 August 2021, the 10th working day from this day is 17 August 2021.
- Common Problems
â™ #VALUE! Error:
If you provide a value in the function which is not a valid date then this error will appear.
Let’s insert a text string within WORKDAY.Â
To use Cell Reference we have written hello in a cell.
Insert the string the WORKDAY function.
This will return a #VALUE! error. Since the string is not a valid date.
Let’s see another example. This time use a date.
Use the function for this date.
We have written the date in yyyy-dd-mm format. Which is not a valid date format in Excel in the US region. So, it returned the error.
â™ #NUM! Error:
If the supplied start_date and/or the supplied days argument results in an invalid date then this error occurs.
We have inserted 03-08-2021 in the function. But the function cannot detect it properly and so returns an invalid date. And the #NUM! error occurred.
Download Practice Workbook
You are welcome to download the practice workbook from the link below.
Conclusion
That’s all for today. We have tried showing how you can use the WORKDAY function to find the workdays. You can use the function from very basic operations to advanced situations, nesting with other functions. Hope you will find this helpful.
Feel free to comment if anything seems difficult to understand. Let us know any of your WORKDAY function-related scenarios where you are stuck, we are ready to help.
Excel WORKDAY Function: Knowledge Hub
- How to Find Last Business Day of Month in Excel
- How to Calculate Working Days Excluding Sundays in Excel
- How to Calculate Working Days in a Month in Excel
<< Go Back to Excel Functions | Learn Excel