Skip to main content
Question

Count days between 2 dates with a twist


Forum|alt.badge.img+5

I have a Start date and end date I am using the Weekdaysub(end date), (Start Date). but i want to add a IF statement like say to add saturdays to the mix.

so if I was to set the date from 5/25/2025 and end on 5/30/2025 but if the saturdays check box was clicked it would also add the saturdays between those dates and return 6 (Monday-Saturday) and if the saturdays was not checked it would return 5 (Monday - Friday)

Mez
Forum|alt.badge.img+7
  • Registered
  • May 28, 2025

WeekdaySub() excludes the end date in the calculation by design. If you're expecting 5 days using these dates, it will return 4. 

If you're good with this from this function, then you can simply check for the checkbox and add 1 to the calc otherwise just return the calc. If not, and you truly want 5 days, then return 6 from these dates, you'll need to add 2 using this function or perform a different calculation.

// assumes your "Saturday" field is entitled "Saturday?" - add 1 day where Sat is checked

If(

  [Saturday?], WeekdaySub([End Date], [Start Date]) + 1,

  WeekdaySub([End Date], [Start Date])

)