NETWORKDAYS Functions – Examples in Excel , VBA, G Sheets
Download the example workbook
This tutorial demonstrates how to use the Excel NETWORKDAYS Function in Excel to get the number of business days between dates.
NETWORKDAYS Function Overview
The NETWORKDAYS Function Returns the number of working days between two dates. Working days include Mon-Fri and exclude Sat-Sun. Optionally, you can exclude holidays.
To use the NETWORKDAYS Excel Worksheet Function, select a cell and type:
(Notice how the formula inputs appear)
NETWORKDAYS Function Syntax and Inputs:
=NETWORKDAYS(start_date,end_date,holidays)
start_date – The start date in Excel serial number format or entered as a date with quotations (“s) surround the date. Example: You can not enter 11/12/2015 directly into the cell. Instead you need to enter “11/12/2015” or you would need to use the corresponding serial number: 42320. Alternatively, you can reference a cell with the date 11/12/2015 entered. Excel automatically converts dates stored in cells into serial format (unless the date is entered as text).
end_date – The end date in Excel serial number format or entered as a date with quotations (“s) surround the date. Example: You can not enter 11/12/2015 directly into the cell. Instead you need to enter “11/12/2015” or you would need to use the corresponding serial number: 42320. Alternatively, you can reference a cell with the date 11/12/2015 entered. Excel automatically converts dates stored in cells into serial format (unless the date is entered as text).
holidays – OPTIONAL. List of holidays to exclude from the “work days”. It can be entered as a list of serial numbers corresponding to the holidays. Alternatively, it can reference a range of cells that contain the holiday dates. Example: 42005,42189,42363 or A1:A3, referencing cells that contain that contain dates: 1/1/2015, 7/4/2015, 12/25/2015.
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.