What Is WORKDAY Function In Excel?
The WORKDAY Excel function helps users calculate the required date, keeping into account the number of working days before or after a given date, excluding the weekends and specified holidays. We can calculate invoice due dates and expected order delivery dates.
The WORKDAY Function In Excel is an inbuilt Date & Time function, which means we can insert the formula from the “Function Library” or enter it directly in the worksheet.
📥Download the ready-to-use Excel template to practice this tutorial yourself.
Download Excel TemplateFor example, the table below contains a set of dates and the number of days.
Frequently Asked Questions (FAQs)
WORKDAY in Excel is in the Formulas tab. Click Formulas → Date & Time → WORKDAY.
The Excel WORKDAY function includes the holidays while determining the work day if you do not specify the holidays list explicitly.
The WORKDAY() argument, holidays, is optional. And if you provide the cell range containing holidays to the function as an argument, the function excludes them from the workday calculations. Otherwise, it includes holidays in the evaluations.
The WORKDAY Excel function does not work due to the following reasons:
· If the argument start_date or holidays is invalid.
· When the argument, days, is non-numeric.
· The WORKDAY() determined date is invalid.
We can use the WORKDAY() in Excel with VBA to determine the corresponding work days.
In the following table, we have a list of dates, the number of days, and the holidays to exclude from the working day calculations.
The steps to use the WORKDAY() in VBA are:
1: With the worksheet with the above table, press the keys Alt+F11 to open the VBA Editor.
2: Then, choose the required VBAProject from the left menu and click Insert → Module to open the Module1 window, where you need to enter the VBA code.
The Module window opens as shown below.
3: Enter the VBA code, shown in the image below, in the Module1 window.
Sub Workday_fn()
Dim wd As Worksheet
Set wd = Worksheets(“FAQ 4”)
wd.Range(“D2”) = Application.WorksheetFunction.WorkDay(wd.Range(“A2”), wd.Range(“B3”), wd.Range(“C2”))
wd.Range(“D3”) = Application.WorksheetFunction.WorkDay(wd.Range(“A3”), wd.Range(“B3”), wd.Range(“C3”))
wd.Range(“D4”) = Application.WorksheetFunction.WorkDay(wd.Range(“A4”), wd.Range(“B4”))
wd.Range(“D5”) = Application.WorksheetFunction.WorkDay(wd.Range(“A5”), wd.Range(“B5”), wd.Range(“C5”))
End Sub
4: Click the Run Sub/UserForm icon in the menu to run the commands.
In the worksheet, we will get the output in the target cells as shown below:
[Output Observation: In the target cells, the WORKDAY() excludes the weekends and the specified holidays while returning the respective future work days as the output.
But in the case of row 4, you need a past work day from1/3/2022. And 21/2/2022 is a holiday that falls in the given number of days range. But as per the requirement, the WORKDAY() ignores the optional argument holidays. Thus, the function counts ten working days in the past from 1/3/2022, excluding only the weekends to return the work day 15/2/2022.]
Download Template
📥Download the ready-to-use Excel template to practice this tutorial yourself.
Download Excel TemplateRecommended Articles
This has been a guide to WORKDAY Excel Function. Here we explain how to use Workday excel formula along with examples & downloadable excel template. You can learn more from the following articles –