number of Saturdays between those 2 dates. Create formula field
FLOOR(( End_Date__c - Start_Date__c )/7)
+
IF(OR (WEEKDAY(Start_Date__c )=7, WEEKDAY(End_Date__c )=7, WEEKDAY(Start_Date__c )>WEEKDAY(End_Date__c )),1,0)
If you want the number of Sundays:
FLOOR(( End_Date__c - Start_Date__c )/7)
+
IF(OR (WEEKDAY(Start_Date__c )=1, WEEKDAY(End_Date__c )=1, WEEKDAY(Start_Date__c )>WEEKDAY(End_Date__c )),1,0)
This is easily changed for any day of the week. You only need to change the "WEEKDAY" number (1 for Sunday, 2 for Monday, 3 for Tuesday, etc) in this part:
WEEKDAY(Start_Date__c )=1, WEEKDAY(End_Date__c )=1
Comments
Post a Comment