WorkingDays ( )

Function stats

Average user rating
38
261
9999
Support
FileMaker 9.0 +
Date posted
11 July 2010
Last updated
31 July 2010
Version
Recursive function
Yes

Author Info
 Daniele Raybaudi

9 functions

Average Rating 5.0

author_avatar



 

Function overview

Prototype

WorkingDays  ( DateStart;   DateEnd;   HolidayList )


Parameters

DateStart  


DateEnd  


HolidayList  


Description

Tags:  Date  

Returns the number of working days between the two dates w/o weekends and holidays.

All you need to do is create the holiday list.

Examples

Sample input

WorkingDays ( "07/07/2010" ; "07/07/2010" ; YourList )


Sample output

1

 

Function code

/*
WorkingDays ( DateStart ; DateEnd ; HolidayList )

returns the number of working days between the two dates.
No weekend days nor any day of the HolidayList
*/

Let (
$counter = $counter + ( Mod ( DateStart - 1 ; 7 ) < 5 and IsEmpty ( FilterValues ( DateStart ; HolidayList ) ) );
Case(
DateStart > DateEnd ; "" ;
DateStart = DateEnd ; $counter & Let( $counter = "" ; "" );
WorkingDays ( DateStart + 1 ; DateEnd ; HolidayList )
)
)

// ===================================
/*

    This function is published on FileMaker Custom Functions
    to check for updates and provide feedback and bug reports
    please visit http://www.fmfunctions.com/fid/261

    Prototype: WorkingDays( DateStart; DateEnd; HolidayList )
    Function Author: Daniele Raybaudi (http://www.fmfunctions.com/mid/38)
    Last updated: 31 July 2010
    Version: 1.1

*/
// ===================================

 

Comments

Delboy
26 February 2012



Great info, create function in FM Pro and using - saved me having to write function ... thank you

Derek
  General comment
Alex
13 October 2012



Thank you so much for this function. Works wonders! I was wondering how can I implement something similar but to calculate an End date, skipping the Holidays on the HolidayList and also weekends?

Basically, I would like to add a number of days to a Start date and reach an End date, having skipped any Holidays within that period and also the weekends. Thanks for any help, I really like how clear this function is.
     Feature request
Daniele Raybaudi
14 October 2012



Try the CF at http://www.fmfunctions.com/fid/338
  General comment

 

 

 

 

 

Top Tags

Text Parsing  (33)
List  (31)
Date  (28)
XML  (26)
Format  (23)
Sql  (22)
Dev  (20)
Debug  (17)
Layout  (15)
Interface  (15)
Text  (14)
Variables  (12)
Filter  (11)
Layout Objects  (11)
Design  (10)
Array  (7)