function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rohan SRohan S 

Exclude weekends in the formula and show the difference

I currently have a date field Difference__c that displays the difference between Today and Last_Call_Made__c (Date field). Here is the formula I used: TODAY() - Last_Call_Made__c. I would like the formula to exclude weekends. Can someone please help me with this?
AnudeepAnudeep (Salesforce Developers) 
Hi Rohan, 

Can you try the below formula?
CASE(MOD(datevalue(CreatedDate) - DATE(1900, 1, 7), 7),
0, datevalue(CreatedDate) +1+2,
1, datevalue(CreatedDate) +2,
2, datevalue(CreatedDate) +2,
3, datevalue(CreatedDate) +2,
4, datevalue(CreatedDate) +2,
5, datevalue(CreatedDate) +2+2,
6, datevalue(CreatedDate) +2+2,
datevalue(CreatedDate)
)

This is a working version based on the following posts

https://developer.salesforce.com/forums/?id=906F00000008vlZIAQ

https://trailblazers.salesforce.com/answers?id=90630000000gpfIAAQ

Let me know if this helps

Thanks, 
Anudeep
Rohan SRohan S
I did go through these threads, but my requirement should show the difference, plus there can be multiple weekends in my case. Not sure how to factor that in.