Category: Date and Time function
This function returns the number of workdays (i.e. all days except Saturday and Sunday) between from_date and to_date. Both date boundaries are inclusive.
Argument | Type | Description |
---|---|---|
from_date | Date or Number (date serial) | An expression representing the first date value to derive the number of workdays from. |
to_date | Date or Number (date serial) | An expression representing the second date value to derive the number of workdays from. |
exclude | Text | (Optional) Dates to exclude from the calculation. This argument should appear as a list of comma-separated dates in text format, enclosed in quotes (i.e., "2020-11-26, 2020-04-24"). |
include | Text | (Optional) Dates to include in the calculation. This argument should appear as a list of comma-separated dates in text format, enclosed in quotes (i.e., "2020-08-15, 2020-03-22"). |
Return value type: Number
The from_date and to_date arguments can take any value or expression that evaluates to a date serial value. Examples include:
The exclude and include arguments need to be a date or list of dates, delimited by commas, enclosed in quotes, and appearing in yyyy-MM-dd format:
workdays(#2020-05-01,#2020-05-20) //Returns 14
workdays(#2019-01-01,#2019-12-31) //Returns 261 (The number of workdays in a non-leap-year year.)
workdays(#2005-12-17, #2005-12-18) //Returns 0 (The 17th is a Sat and the 18th is a Sun.)
workdays(#2019-01-01,#2019-12-31,"2019-07-13","2019-07-26") //Returns 261 (1 exclusion, 1 inclusion.)
workdays(#2019-01-01,#2019-12-31,"2019-05-24,2019-06-28") //Returns 259 (2 exclusions.)
workdays(#2019-01-01,#2019-12-31,"","2019-06-29") //Returns 262. (No exclusions, one inclusion.)