 ShowAll Questionssorted byDate Posted Shahil Khan 1

# Need to create a Formula Field called Days Overdue

Hi All.
I have a requirement which requires me to create a formula field, i dont have much background on Salesforce and still learning, so any help will be appreciated!

I am attempting to create a new formula field called "Days Overdue" on a custom object and the logic for the field should be as below;

When the "Status__C" does not equal to (<>) "closed", and
If "Actual End date__C" is blank, "Days Overdue" = Today - Planned End Date__C
If "Actual End date__C" is not blank, "Days Overdue" = Today - Actual End Date__C

When the "Status__C" equal to (=) "closed",
--> "Days Overdue" = Actual End Date__C - Planned End Date__C

I want to incorporate values for both conditions (Status <> Closed & Status Closed) in the same "Days Overdue" Field

Thanks! @anilbathula@
Hi Shahil Khan1

try this formula :-

IF(AND(Status__C!='Closed',Actual End date__C==null),Today - Planned End Date__C,
if(AND(Status__C!='Closed',Actual End date__C!=null),Today - Actual End Date__C,
if(AND(Status__C=='Closed',Actual End date__C!=null,Planned End Date__C!=null),Actual End Date__C - Planned End Date__C,null)))

Thanks
Anil.B Shahil Khan 1
Thanks for the help Anil,
I've tried using this formula but since Status__C is a picklist value i am getting an error. I am pretty new to Salesforce so if you could help me understand how to incorporate the ISPICKVAL with the IF statement in the formula you've provided, it'll help a great deal. Raj Vakati
try this

```IF(AND(Text(Status__C)!='Closed',Actual End date__C==null),Today - Planned End Date__C,
if(AND(Text(Status__C)!='Closed',Actual End date__C!=null),Today - Actual End Date__C,
if(AND(Text(Status__C)=='Closed',Actual End date__C!=null,Planned End Date__C!=null),Actual End Date__C - Planned End Date__C,null)))``` Nandigam Rajesh
Hi Sahil
This may helps you:
```IF(AND(Text(Status__C)!='Closed',Actual End date__C==null),Today - Planned End Date__C,
if(AND(Text(Status__C)!='Closed',Actual End date__C!=null),Today - Actual End Date__C,
if(AND(Text(Status__C)=='Closed',Actual End date__C!=null,Planned End Date__C!=null),Actual End Date__C - Planned End Date__C,null)))```

Regards
Rajesh