I need to count the number of Saturdays between two dates. Any ideas?
 840 Points
Posted 3 months ago
Quick Base Junkie (find me on YouTube)
 1,320 Points
Dealing with dates can be tricky. Something along these lines should work:
var number WEEKDAYADD = If(DayOfWeek([Date Two])=6,1,0);
ToDays((FirstDayOfWeek([Date Two])FirstDayOfWeek([Date One])))/7 + $WEEKDAYADD
Basically, I'm adjusting the dates to both startĀ at the beginning of the week, so that I can calculate the number of whole weeks, between them (and thus the Saturdays). Since the calendar starts on Sunday the first week will always have a Saturday in it. To compensateĀ for the last week I check the day that the date falls on and either add one or zero to the total weeks.
I haven't tested it for all scenarios.
Sharon
var number WEEKDAYADD = If(DayOfWeek([Date Two])=6,1,0);
ToDays((FirstDayOfWeek([Date Two])FirstDayOfWeek([Date One])))/7 + $WEEKDAYADD
Basically, I'm adjusting the dates to both startĀ at the beginning of the week, so that I can calculate the number of whole weeks, between them (and thus the Saturdays). Since the calendar starts on Sunday the first week will always have a Saturday in it. To compensateĀ for the last week I check the day that the date falls on and either add one or zero to the total weeks.
I haven't tested it for all scenarios.
Sharon
(Edited)
Related Categories

Formulas & functions
 2774 Conversations
 64 Followers