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
Mohan Raj 33Mohan Raj 33 

How to change this formula in working days only (like only calculated Monday to Friday only)

((DATEVALUE( NOW()) - DATEVALUE(Calculating_Date__c))-1)*24 
+
 (24 - VALUE(MID(RIGHT((TEXT( Calculating_Date__c  - 0.2916)),9),0,2)))
+
 VALUE(MID(RIGHT((TEXT(  NOW() - 0.2916)),9),0,2))

here I using the formula for calculating the time difference in the Calculating Date and Now() value in HOURS only. Here the value for the 0.2916 is for Our time zone is GMT - 7 so that's why it's subtrcted there to get the local time from the GMT so now I want to try calculate this formula field in only for the working days (Monday to Friday Only).

i.e the validation only  done to Monday to Friday doesn't to calculate the saturday and sunday timevalues to in the calculating timedifference. Even If I selected to the Saturday and Sunday value in the Calculating Date it's to be automatically calculated from Monday Onwords to the end value of NOW() value. 

So please help me to solve the problem.For answer's thanks in advance .Thank you, Mohan
 
Best Answer chosen by Mohan Raj 33
Tejas KardileTejas Kardile
Hi,

Please go thorugh below salesforce article which will help you in calculating working day:
https://help.salesforce.com/HTViewSolution?id=000004526
https://help.salesforce.com/HTViewSolution?id=000003920

Thanks

All Answers

Tejas KardileTejas Kardile
Hi,

Please go thorugh below salesforce article which will help you in calculating working day:
https://help.salesforce.com/HTViewSolution?id=000004526
https://help.salesforce.com/HTViewSolution?id=000003920

Thanks
This was selected as the best answer
Mohan Raj 33Mohan Raj 33
@Tejas Kardile Thanks For Redirecting sir.
Mohan Raj 33Mohan Raj 33
@Tejas Kardile sir, Can you explain Why the number's are here in that code?
Weekday Count Formula:

  CASE(MOD( StartDate__c - DATE(1985,6,24),7), 
  0 , CASE( MOD( EndDate__c - StartDate__c ,7),1,2,2,3,3,4,4,5,5,5,6,5,1), 
  1 , CASE( MOD( EndDate__c - StartDate__c ,7),1,2,2,3,3,4,4,4,5,4,6,5,1), 
  2 , CASE( MOD( EndDate__c - StartDate__c ,7),1,2,2,3,3,3,4,3,5,4,6,5,1), 
  3 , CASE( MOD( EndDate__c - StartDate__c ,7),1,2,2,2,3,2,4,3,5,4,6,5,1), 
  4 , CASE( MOD( EndDate__c - StartDate__c ,7),1,1,2,1,3,2,4,3,5,4,6,5,1), 
  5 , CASE( MOD( EndDate__c - StartDate__c ,7),1,0,2,1,3,2,4,3,5,4,6,5,0), 
  6 , CASE( MOD( EndDate__c - StartDate__c ,7),1,1,2,2,3,3,4,4,5,5,6,5,0), 
  999) 
  + 
  (FLOOR(( EndDate__c - StartDate__c )/7)*5)

I point to the number is 1,2,2,3,3,4,4,5,5,5,6,5,1 like the number in the CASE function and it's represents what?