Now there can be times when you would want to calculate the total number of working days between 2 dates. For example, number or working days for employees. number of working days when banks, insurance offices would be working, and so on.
You can use the NETWORKDAYS function to calculate the number of working days in a given month. It automatically excludes the weekends. You can also specify the particular holidays and then count the business days.
NETWORKDAYS(start_date, end_date, [holidays])
The function uses the following arguments:
- Start_date (required argument) – The Start date for the month
- End_date (required argument) – The End date for the month.
- Holidays (optional argument) – This specifies the list of holidays that should be excluded from the working days calculation.
If you have String Date
If you have date in Unix time or from Date & Time control
You say for example you are providing the start_date and end_date from the datepicker controls. No holiday is specified. So if the dates are 01/01/2020 and 06/06/2020 then:
Output will be 113 working days .
- The NETWORKDAYS function includes both the start date and end date while calculating.
- An error is shown if the date given in the argument is not a valid date. Hence in the example, above we are using the DATE() function.
- In the example above, the start date and end date can be values from controls if required.