NETWORKDAYS
Use the NETWORKDAYS function to return the number of whole working days between start_date and end_date. Working days exclude weekends and any dates identified in holidays.
Use
NETWORKDAYS( start_date, end_date [, holidays] )
Returns the number of whole workdays between two dates.
| Parameter | Required | Description |
|---|---|---|
| start_date | Yes | a date that represents the start date |
| end_date | Yes | a date that represents the end date |
| holidays | No | an array of dates to exclude from the working calendar |
| Returns | Number |
Examples
Calculating Processing Time for SLA Tracking
In a "Manager Review" or "Quality Audit" Activity step, you may want to display how many business days have elapsed since the request was first submitted to ensure it meets Service Level Agreements (SLAs).
- Scenario: You want to map a value to an Input data field called
DaysInProgressto show the reviewer the current age of the request in working days. - Formula:
NETWORKDAYS(@prop.StartedOn, TODAY()) - Logic:
@prop.StartedOn: This system property retrieves the exact date and time the approval run was initiated.TODAY(): This function returns the current date.- Result: The formula returns a Number representing the business days that have passed, ignoring weekends, which provides a more accurate performance metric than a simple calendar day count.
Validating Leave Requests Against Company Holidays
You can use NETWORKDAYS in an Output Validation Formula to ensure a user is submitting a request that contains at least one actual working day, while also accounting for fixed company closures.
- Scenario: A user fills out a "Leave Request" form with a
StartDateand anEndDate. The company has a Constant Array called#CompanyHolidaysthat lists all dates the office is closed. - Formula:
ASSERT(NETWORKDAYS(@Trigger.out.StartDate, @Trigger.out.EndDate, #CompanyHolidays) > 0, "Your selected dates do not include any working days.") - Logic:
@Trigger.out: Accesses the specific start and end dates captured on the initial trigger form.#CompanyHolidays: This is the optional third parameter; it tells the function to skip any dates found in that constant list.ASSERT: If the resulting count of working days is zero (for example, if the user selected a weekend or a public holiday), display the custom error message and prevent the form from being submitted.