* merge networkdays, networkdays.intl #33 * merge time, timevalue, hour, minute, second #35 * merge datedif, datevalue #36 * merge days, days360, weekday, weeknum, workday, workday.intl, yearfrac, isoweeknum #41 * from excel helper * fix build * date time macros * de-dupe weekend * serial helper * de-dupe now today * weekend pattern enum * remove unused clippy wrong self * fix docs * add test coverage * fix build * fix cursor comment * PR coments + xlsx date time
4.4 KiB
layout, outline, lang
| layout | outline | lang |
|---|---|---|
| doc | deep | en-US |
NETWORKDAYS.INTL function
::: warning Note: This draft page is under construction 🚧 :::
Overview
NETWORKDAYS.INTL is a function of the Date and Time category that calculates the number of working days between two dates, with customizable weekend definitions and optionally specified holidays.
Usage
Syntax
NETWORKDAYS.INTL(start_date, end_date, [weekend], [holidays]) => workdays
Argument descriptions
- start_date (number, required). The start date expressed as a serial number.
- end_date (number, required). The end date expressed as a serial number.
- weekend (number or string, optional). Defines which days are considered weekends. Default is 1 (Saturday-Sunday).
- holidays (array or range, optional). A list of dates to exclude from the calculation, expressed as serial numbers.
Weekend parameter options
The weekend parameter can be specified in two ways:
Numeric codes:
- 1 (default): Saturday and Sunday
- 2: Sunday and Monday
- 3: Monday and Tuesday
- 4: Tuesday and Wednesday
- 5: Wednesday and Thursday
- 6: Thursday and Friday
- 7: Friday and Saturday
- 11: Sunday only
- 12: Monday only
- 13: Tuesday only
- 14: Wednesday only
- 15: Thursday only
- 16: Friday only
- 17: Saturday only
String pattern: A 7-character string of "0" and "1" where "1" indicates a weekend day. The string represents Monday through Sunday. For example, "0000011" means Saturday and Sunday are weekends.
Additional guidance
- If the supplied start_date and end_date arguments have fractional parts, NETWORKDAYS.INTL uses their floor values.
- If start_date is later than end_date, the function returns a negative number.
- Empty cells in the holidays array are ignored.
- The calculation includes both the start and end dates if they are workdays.
Returned value
NETWORKDAYS.INTL returns a number representing the count of working days between the two dates.
Error conditions
- In common with many other IronCalc functions, NETWORKDAYS.INTL propagates errors that are found in its arguments.
- If fewer than 2 or more than 4 arguments are supplied, then NETWORKDAYS.INTL returns the
#ERROR!error. - If the start_date or end_date arguments are not (or cannot be converted to) numbers, then NETWORKDAYS.INTL returns the
#VALUE!error. - If the start_date or end_date values are outside the valid date range, then NETWORKDAYS.INTL returns the
#NUM!error. - If the weekend parameter is an invalid numeric code or an improperly formatted string, then NETWORKDAYS.INTL returns the
#NUM!or#VALUE!error. - If the holidays array contains non-numeric values, then NETWORKDAYS.INTL returns the
#VALUE!error.
Details
IronCalc utilizes Rust's chrono crate to implement the NETWORKDAYS.INTL function. This function provides more flexibility than NETWORKDAYS by allowing custom weekend definitions.
Examples
See some examples in IronCalc.
Links
- See also IronCalc's NETWORKDAYS function for the basic version with fixed weekends.
- Visit Microsoft Excel's NETWORKDAYS.INTL function page.
- Both Google Sheets and LibreOffice Calc provide versions of the NETWORKDAYS.INTL function.