Skip to main content
Hello all!

 

I have read several previous questions and answers, and still can't seem to find the right combination of what I'm looking for.

 

I need a formula that will calculate the difference between two date/time fields, in business hours only, while still excluding weekends.

 

I have found how to calculate business hours without excluding weekends, and how to exclude weekends, but only in business days. Anyone know how to take both into account?
63 Antworten
  1. 4. Nov. 2022, 09:38

    @Shawn Low

     

    I know it too long to give answer. But Below formula helps me to calculate the diffrence between date/time excluding weekends . 

     

    TEXT(ROUND((CASE(MOD( DATEVALUE(CreatedDate) - DATE(1985,6,24),7),  0 , CASE( MOD( DATEVALUE(Pending_Approval_Time__c) - DATEVALUE(CreatedDate) ,7),1,2,2,3,3,4,4,5,5,5,6,5,1),  1 , CASE( MOD( DATEVALUE(Pending_Approval_Time__c) - DATEVALUE(CreatedDate) ,7),1,2,2,3,3,4,4,4,5,4,6,5,1),  2 , CASE( MOD( DATEVALUE(Pending_Approval_Time__c) - DATEVALUE(CreatedDate) ,7),1,2,2,3,3,3,4,3,5,4,6,5,1),  3 , CASE( MOD( DATEVALUE(Pending_Approval_Time__c) - DATEVALUE(CreatedDate) ,7),1,2,2,2,3,2,4,3,5,4,6,5,1),  4 , CASE( MOD( DATEVALUE(Pending_Approval_Time__c) - DATEVALUE(CreatedDate) ,7),1,1,2,1,3,2,4,3,5,4,6,5,1),  5 , CASE( MOD( DATEVALUE(Pending_Approval_Time__c) - DATEVALUE(CreatedDate) ,7),1,0,2,1,3,2,4,3,5,4,6,5,0),  6 , CASE( MOD( DATEVALUE(Pending_Approval_Time__c) - DATEVALUE(CreatedDate) ,7),1,1,2,2,3,3,4,4,5,5,6,5,0),  999)  +  (FLOOR(( DATEVALUE(Pending_Approval_Time__c) - DATEVALUE(CreatedDate) )/7)*5) )  -1  +(DATETIMEVALUE(DATEVALUE(CreatedDate)) - DATETIMEVALUE(CreatedDate)  + DATETIMEVALUE(Pending_Approval_Time__c) - DATETIMEVALUE(DATEVALUE(Pending_Approval_Time__c))),0)) & " Days " &   TEXT(  FLOOR(MOD(( Pending_Approval_Time__c - CreatedDate)*24,24))  ) &" Hours " &   TEXT(  Round(MOD((Pending_Approval_Time__c - CreatedDate)*1440,60),0)  ) &" Minutes ".

     

    But I am in other issue for calculating business hours and excluding the weekends. I tried all the above formual's. Every formula's failing in some scenarios

0/9000