Brian Dunning's FileMaker Custom Functions

calcEndDate ( startDate ; numDays ; loopCount ; holidayList ; allowWeekends ; direction )

Calculate date by adding or subtracting days, option for skipping weekends

  Average rating: 3.8 (46 votes) Log in to vote

Shan Younker   Shan Younker
Shan Younker

Share on Facebook Share on Twitter

  Sample input:
CalcEndDate (9/9/2009; 5; 0; $$holidayList; "" ; "b")
  Sample output:

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

Function for calculating an end date based on a start date and a number of days. Function has options to calculate forward or backwards and can allow for an end date to fall on a weekend or holiday or not. The function is a simple recursive loop that adds or subtracts one day from the start date each time through the loop, no complicated date formulas required. When the number of times through the loop equals the number of days originally passed to the function, the function returns the calculated date. If the flag is set to allow a weekend/holiday end date, the function does simply adds or subtracts the number of days from the start date.



Jeffrey E. Bloch   Jeffrey E. Bloch, Fairfield, CT
Feb 15, 2011

Great work!

The only issue I have is:

Start Date: 3-15-10
End Date: 4-15-10

If I prepare a report in any given database, based upon these dates, and want to compare the results with data from each of the past 6 months, how many days do I tell your custom function to back up since some months have more/less days than others?


I hope you don't mind me asking.
Jeffrey E. Bloch   Jeffrey E. Bloch, Fairfield, CT
Feb 15, 2011
Sorry Shan, I noticed this was and assumed these were his.

Nice work!
Jeff Byers   Jeff Byers, Ft. Lauderdale, FL
Mar 9, 2013

I'm using this custom function... calcEndDate...
which is working fine at excluding weekend dates.

However, I'm having trouble incorporating my holidayList of exclusion
dates, into the function.

I currently have a separate Holiday List file of 10 holiday records/dates.

If I am understanding correctly... I need to get these 10 date records
into a single global field, for the function to exclude the holidays from.

Not sure if this is the correct approach... please advise.

I also took the approach, of setting up a separate table, with 10 individual records... but ended up with the same resulting conundrum...

I believe the calcEndDate function requires a single global field of holiday dates.

It seems I'm still not grasping the simplicity of what needs to be done.

The sample input references $$holidayList...
however I'm not well versed in the use of global variables yet.
Fred   Fred, CA
Oct 9, 2017
For the holidayList, just create a field and set it to Global. In the field, just list out the holidays dates, one date per line as such:


No commas seem to be needed.
Steve Kemp   Steve Kemp
Aug 28, 2019
I've noticed an issue when using the holidayList parameter. If my dates (I'm using DD/MM/YYYY format here) doesn't have a leading zero for the day and month value the holidayList parameter doesn't work correctly. Any way to get around this?

Log in to post comments.


Note: these functions are not guaranteed or supported by Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 16 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: