Skip to main content

NETWORKDAYS

Returns the number of whole workdays between two dates.

Syntax

expression.NETWORKDAYS(arg1, arg2, arg3);

expression - A variable that represents a ApiWorksheetFunction class.

Parameters

NameRequired/OptionalData typeDefaultDescription
arg1RequiredApiRange | ApiName | numberA serial date number that represents the start date.
arg2RequiredApiRange | ApiName | numberA serial date number that represents the end date.
arg3OptionalApiRange | number[]An optional range or array of one or more serial date numbers to exclude from the working calendar, such as state and federal holidays and floating holidays.

Returns

number

Example

This example shows how to return the number of whole workdays between two dates.

// How to get the number of whole workdays between two dates.

// Use a function to get number of days between two dates.

const worksheet = Api.GetActiveSheet();

let func = Api.GetWorksheetFunction();
let ans = func.NETWORKDAYS("3/16/2018", "12/31/2018");

worksheet.GetRange("C1").SetValue(ans);