0

I have written a formula to calculate the difference between two Date/Time fields,

Please find the formula

ROUND(24*( (5*FLOOR((DATEVALUE(First_Response__c)-DATE(1996,01,01))/7) + MIN(5,MOD(DATEVALUE(First_Response__c)-DATE(1996,01,01), 7) + MIN(1, 24/24*(MOD(First_Response__c-DATETIMEVALUE('1996-01-01 12:00:00'), 1))) ))(5*FLOOR((DATEVALUE(CreatedDate)-DATE(1996,01,01))/7) + MIN(5, MOD(DATEVALUE(CreatedDate)-DATE(1996,01,01), 7) + MIN(1, 24/24*(MOD(CreatedDate-DATETIMEVALUE('1996-01-01 12:00:00'), 1))) )) ), 2)

Here I have a case whose created date is 12/12/2016 2:16AM and Firstresponse date is 12/12/2016 10:54 AM now the case response hour formula field shows me the difference between the above as -15.37 .

Please Advise.

0

Use this formula:

ROUND(
 /* 24 * 5 days * weeks */
 24 * 5 * FLOOR((First_Response__c-CreatedDate)/7)
  /* max 24 * 5 days */
 + MIN( 120, 
   /* days from the last week */
   24 * FLOOR( MOD((First_Response__c-CreatedDate)/7, 5) )
   /* hours difference */
   + MOD(First_Response__c-CreatedDate, 1)
 ),
2)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.