NETWORKDAYS Functions – Examples in Excel , VBA, G Sheets
Written by
Reviewed by
Download the example workbook
This tutorial demonstrates how to use the NETWORKDAYS Function in Excel to get the number of business days between dates.
Calculate Business / Working Days
The NETWORKDAYS Function calculates the number of business days between two dates:
=NETWORKDAYS(B4,C4)
If the end_date is before the start_date NETWORKDAYS will return a negative value:
=NETWORKDAYS(B4,C4)
To return the absolute number of working days, use the ABS Function:
=ABS(NETWORKDAYS(B4,C4)
By default, NETWORKDAYS will ignore all holidays. However you can use a 3rd optional argument to define a range of holidays:
=NETWORKDAYS(B4,C4,F3:F4)
NETWORKDAYS in Google Sheets
The NETWORKDAYS Function works exactly the same in Google Sheets as in Excel:
NETWORKDAYS Examples in VBA
You can also use the NETWORKDAYS function in VBA. Type:
application.worksheetfunction.networkdays(start_date,end_date,holidays)
Executing the following VBA statements
Range("C2") = Application.WorksheetFunction.Days360(Range("A2"), Range("B2"), False)
Range("C3") = Application.WorksheetFunction.Days360(Range("A3"), Range("B3"), False)
Range("C4") = Application.WorksheetFunction.Days360(Range("A4"), Range("B4"), False)
Range("C5") = Application.WorksheetFunction.Days360(Range("A5"), Range("B5"), False)
Range("D2") = Application.WorksheetFunction.Days(Range("B2"), Range("A2"))
Range("D3") = Application.WorksheetFunction.Days(Range("B3"), Range("A3"))
Range("D4") = Application.WorksheetFunction.Days(Range("B4"), Range("A4"))
Range("D5") = Application.WorksheetFunction.Days(Range("B5"), Range("A5"))
Range("E2") = Application.WorksheetFunction.NetworkDays(Range("A2"), Range("B2"))
Range("E3") = Application.WorksheetFunction.NetworkDays(Range("A3"), Range("B3"))
Range("E4") = Application.WorksheetFunction.NetworkDays(Range("A4"), Range("B4"))
Range("E5") = Application.WorksheetFunction.NetworkDays(Range("A5"), Range("B5"))
will produce the following results:
For the function arguments (start_date, etc.), you can either enter them directly into the function, or define variables to use instead.