+ Start a Discussion
Jack Thomas 3Jack Thomas 3 

Date Type Formula

hey guys i want to create a formula field it should return  date  with adding 20 days on it but it should not add weekends days. I Have one date type field . Eg  EmployeeStartDate__c : 07/07/2017 and date return date by adding 20 days .

 

Raj VakatiRaj Vakati
HI Jack ,
Refer this link

http://salesforce-shruthi.blogspot.com/2011/09/exclude-saturdays-and-sundays-while.html
 
Raj VakatiRaj Vakati
HI Jack ,
Use this. 
 
Data Type	Formula	 	 
CASE( 
MOD( ttttteee__SLAExpirationDate__c - DATE(1900, 1, 7), 7), 
0, (ttttteee__SLAExpirationDate__c ) + 20+ FLOOR((2-1)/5)*2, 
1, (ttttteee__SLAExpirationDate__c ) + 20+ FLOOR((2)/5)*2, 
2, (ttttteee__SLAExpirationDate__c ) + 20 + FLOOR((2+1)/5)*2, 
3, (ttttteee__SLAExpirationDate__c ) + 20+ FLOOR((2+2)/5)*2, 
4, (ttttteee__SLAExpirationDate__c ) + 20+ FLOOR((2+3)/5)*2, 
5, (ttttteee__SLAExpirationDate__c ) + 20 + CEILING((2)/5)*2, 
6, (ttttteee__SLAExpirationDate__c ) - IF(20>0,1,0) + 20+ CEILING((2)/5)*2, 
null)