you can try this formula:
Let ( [
a=startdate_field ; // may not be empty
b=enddate_field ; // b ≥ a !!!!!!
date_a=a+Case( day_a=1 ; 1 ; day_a=7 ; 2 ; 0 ) ; // convert a date in the weekend to the date of the next monday
date_b=b+Case( day_b=1 ; -2 ; day_b=7 ; -1 ; 0 ) ; // convert a date in the weekend to the date of the previous friday
full_weeks=Floor((date_b-date_a)/7) ; // get the number of week between the 2 calculated dates
extra_days= dow_b-dow_a + Case ( dow_a > dow_b ; 5 ) ] ; // get the difference between the weekdays of the 2 calculated dates
5*full_weeks+extra_days+1 ) // add up both results to get the difference and add 1 to get the number of workingdays
Thank you for your post.
The solution by "menno" is correct (Thank you!). You may also want to look at a few Knowledge Base Articles for some related date calculations with explanations:
Article #5281 - Calculating Number of Weekdays (Work Days) Between Dates
Article #5053 - Calculating a Weekday Date
Article #3926 - Calculate a Finish Date Given a Starting Date and the Number of Work Days
We've found that "calculating workdays" always encounters issues for week days where the business has closed for a holiday. I finally set up a "calendar" file with one record per day open and added some tools for helping administrators to log specific dates as "holiday closure" dates. My systems can then "count" the number of days the business will actually be open to determine a date "x working days in the future".