+ Start a Discussion
Sourav PSourav P 

How to remove the week-ends and holidays from a Task aging field

Hi,
I have a task againg field , formula as below ( type " number")
LastModifiedDate - CreatedDate
But i want to exclude the sat-sun and a public holiday list from this number. May i know how to modify the formula ? thnx
 
NagendraNagendra (Salesforce Developers) 
Hi Sourav, 

Hope this would work 
CASE(MOD( CreatedDate - DATE(1985,6,24),7), 
  0 , CASE( MOD( LastModifiedDate  - CreatedDate ,7),1,2,2,3,3,4,4,5,5,5,6,5,1), 
  1 , CASE( MOD( LastModifiedDate  - CreatedDate ,7),1,2,2,3,3,4,4,4,5,4,6,5,1), 
  2 , CASE( MOD( LastModifiedDate  - CreatedDate ,7),1,2,2,3,3,3,4,3,5,4,6,5,1), 
  3 , CASE( MOD( LastModifiedDate  - CreatedDate ,7),1,2,2,2,3,2,4,3,5,4,6,5,1), 
  4 , CASE( MOD( LastModifiedDate  - CreatedDate ,7),1,1,2,1,3,2,4,3,5,4,6,5,1), 
  5 , CASE( MOD( LastModifiedDate  - CreatedDate ,7),1,0,2,1,3,2,4,3,5,4,6,5,0), 
  6 , CASE( MOD( LastModifiedDate  - CreatedDate ,7),1,1,2,2,3,3,4,4,5,5,6,5,0), 
  999) 
  + 
  (FLOOR(( LastModifiedDate  - CreatedDate )/7)*5) - IF('Holiday Date' > CreatedDate && 'Holiday Date < endDate,1,0 )
Replace 'Holiday Date' with the public Holiday dates, if there are more than one public holidays, the for each date there will be a 'IF' condition similar to the one at the end of the above formula.

Kindly mark this as solved if the reply was helpful.

Thanks,
Nagendra