How can i count only weekdays in this formula? - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Chris BeneschChris Benesch 

How can i count only weekdays in this formula?

I've created the following formula in order to count the number of days a Web To Lead record is in one of two Lead Status'.  My question is, is it possible to only count weekdays in this formula?

IF(ISPICKVAL(Status, "Open"), ROUND(NOW()-CreatedDate, 0), IF(ISPICKVAL(Status, "Follow Up Needed"), ROUND(NOW()-CreatedDate, 0), null))
Dierre DeLaRosbyDierre DeLaRosby
I think you can just add the following line to your code:

xxx your code &&
CASE(MOD(today()-DATE(1900,1,6),7),0,0,1,0,2,1,3,1,4,1,5,1,6,1,0) == 1

I cannibalized this code from http://success.salesforce.com/ideaView?c=09a30000000D9xo&id=087300000006tamAAA

This example calculates the day of the week as a number (0 = Saturday, 1 = Sunday, 2 = Monday, 3 = Tuesday, etc.)