If the day falls on weekend, get the last business day of the week #inSalesforce

Suppose the date field name is theDateField__c and we are getting the last business day of the week if the day of the week is weekend for the date in theDateField__c


Create formula field named theLastBusinessDate__c with return type Date:


theLastBusinessDate__c (API name)  is

theDateField__c -

CASE(MOD(theDateField__c - DATE(1900, 1, 1), 7),

5,1,

6,2,

0

)


Note: Subtract 1 day if Saturday and 2 if Sunday

Comments