Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
ShowAll Questionssorted byDate Posted
chanti k

# How to calculate the caseage based on status changed value only for weekdays

Hi All,

I want calculate the "caseage" based on status changed value only for weekdays.

Example: here Caseage means : created case and closed cose

i have picklist values of Status : In progress, pending and rejcted

Chanti
in order to satisfy the above condition:

Create a custom fields first to capture the date/ time for each status changes as Status_Change_Start__c (date/time field)
Status_Change_End__c (date/time field). Then create a workflow that triggers when the case changes as "inprogresss". "pending" and "Rejected".

Create a custom formula field on the Case object to calculate the "caseage" in hours. Let's call it Case_Age_in_Hours__c. Use the following formula:

IF(ISBLANK(Status_Change_End__c),    NULL,    FLOOR( (Status_Change_End__c - Status_Change_Start__c) * 24      -
(2 * FLOOR((Status_Change_Start__c - DATE(1985,6,24)) / 7)
+
MAX(MIN(5,
ROUND((Status_Change_Start__c - DATE(1985,6,24)) +
MOD(Status_Change_Start__c - DATE(1985,6,24) -
FLOOR((Status_Change_Start__c - DATE(1985,6,24)) / 7) * 7, 7) / 7), 0), 1)
-
MAX(MIN(5,
ROUND((Status_Change_End__c - DATE(1985,6,24)) +
MOD(Status_Change_End__c - DATE(1985,6,24) -
FLOOR((Status_Change_End__c - DATE(1985,6,24)) / 7) * 7, 7) / 7), 0), 1)
)
)

i hope i've solved your question. if you like my answer, Please mark it as a best solution