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

Popular posts from this blog

Salesforce Spring 16 Release Exam (Maintenance Exam Q&A) for Developer 201 Admin

Show Hyper Link On Add Error in Salesforce Trigger

Show the Success Message before Redirecting the Detail page on Visualforce Page