# networkdays - script and chart function

The networkdays function returns the number of working days (Monday-Friday) between and including start\_date and end\_date taking into account any optionally listed holiday.

Syntax:

networkdays (start\_date, end\_date [, holiday])

**Return data type:** integer

Arguments:

Networkdays arguments

| Argument | Description |
| --- | --- |
| start\_date | The start date to evaluate. |
| end\_date | The end date to evaluate. |
| holiday | Holiday periods to exclude from working days. A holiday period is stated as a start date and an end date, separated by commas.<br><br>Example: `  '25/12/2013', '26/12/2013' `<br><br>You can specify more than one holiday period, separated by commas.<br><br>Example: `  '25/12/2013', '26/12/2013', '31/12/2013', '01/01/2014' ` |

Examples and results:

These examples use the date format DD/MM/YYYY. The date format is specified in the SET DateFormat statement at the top of your load script. Change the format in the examples to suit your requirements.

Example 1:

`networkdays ('19/12/2013', '07/01/2014')`

Returns 14. This example does not take holidays into account.

Example 2:

`networkdays ('19/12/2013', '07/01/2014', '25/12/2013', '26/12/2013')`

Returns 12. This example takes the holiday 25/12/2013 to 26/12/2013 into account.

Example 3:

`networkdays ('19/12/2013', '07/01/2014', '25/12/2013', '26/12/2013', '31/12/2013', '01/01/2014')`

Returns 10. This example takes two holiday periods into account.

Example 4:

Add the example script to your document and run it. Then add, at least, the fields listed in the results column to a sheet in your document to see the result.

`PayTable:` `LOAD recno() as InvID, * INLINE [` `InvRec|InvPaid` `28/03/2012|28/04/2012` `10/12/2012|01/01/2013` `5/2/2013|5/3/2013` `31/3/2013|01/5/2013` `19/5/2013|12/6/2013` `15/9/2013|6/10/2013` `11/12/2013|12/01/2014` `2/3/2014|2/4/2014` `14/5/2014|14/6/2014` `13/6/2014|14/7/2014` `7/7/2014|14/8/2014` `4/8/2014|4/9/2014` `] (delimiter is '|');` `NrDays:` `Load *,` `NetWorkDays(InvRec,InvPaid) As PaidDays` `Resident PayTable;` `Drop table PayTable;`

` `

The resulting table shows the returned values of NetworkDays for each of the records in the table.

Example 4 results

| InvID | InvRec | InvPaid | PaidDays |
| --- | --- | --- | --- |
| 1 | 28/03/2012 | 28/04/2012 | 23 |
| 2 | 10/12/2012 | 01/01/2013 | 17 |
| 3 | 5/2/2013 | 5/3/2013 | 21 |
| 4 | 31/3/2013 | 01/5/2013 | 23 |
| 5 | 19/5/2013 | 12/6/2013 | 18 |
| 6 | 15/9/2013 | 6/10/2013 | 15 |
| 7 | 11/12/2013 | 12/01/2014 | 23 |
| 8 | 2/3/2014 | 2/4/2014 | 23 |
| 9 | 14/5/2014 | 14/6/2014 | 23 |
| 10 | 13/6/2014 | 14/7/2014 | 22 |
| 11 | 7/7/2014 | 14/8/2014 | 29 |
| 12 | 4/8/2014 | 4/9/2014 | 24 |