ShowAll Questionssorted byDate Posted
Srinivas Bandi 4

# Need to calculate case in different status

Hi,

I want to calculate case age in diffrent status and stop calculating if the status is "123" or"456"

thanks
Nagendra (Salesforce Developers)
Hi Srinivas,

Please find the sample code below which will calculate the age of a case in business days if it's open, closed, or in a specific status and tweak it as per your requirement which will point you further in the right direction.
```IF(AND(IsClosed),

(
5*FLOOR((DATEVALUE(ClosedDate)-DATE(1996,01,01))/7) +
MIN(5, MOD(DATEVALUE(ClosedDate)-DATE(1996,01,01), 7))
) - (
5*FLOOR((DATEVALUE(CreatedDate)-DATE(1996,01,01))/7) +
MIN(5, MOD(DATEVALUE(CreatedDate)-DATE(1996,01,01), 7))
),

IF(NOT(IsNull(Waiting_Confirmation_Date__c)),
(
5*FLOOR((Waiting_Confirmation_Date__c - DATE(1996,01,01))/7) +
MIN(5, MOD(Waiting_Confirmation_Date__c - DATE(1996,01,01), 7))
) - (
5*FLOOR((DATEVALUE(CreatedDate)-DATE(1996,01,01))/7) +
MIN(5, MOD(DATEVALUE(CreatedDate)-DATE(1996,01,01), 7))
),

(
5*FLOOR((TODAY()-DATE(1996,01,01))/7) +
MIN(5, MOD(TODAY()-DATE(1996,01,01), 7))
) - (
5*FLOOR((DATEVALUE(CreatedDate)-DATE(1996,01,01))/7) +
MIN(5, MOD(DATEVALUE(CreatedDate)-DATE(1996,01,01), 7))
)))```
Hope this helps.

Mark this as solved if it's resolved.

Thanks,
Nagendra