function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shahil Khan 1Shahil 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@@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 1Shahil 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 VakatiRaj 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 RajeshNandigam 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
Suraj Tripathi 47Suraj Tripathi 47
Hi,

IF(AND( ISPICKVAL(Pay_Stage__c, "Invoice" ),Pay_Due_Date__c < TODAY() ), TEXT(TODAY() - Pay_Due_Date__c) & " Days for Due Date", IF( AND( ISPICKVAL(Pay_Stage__c, "Invoice" ),Pay_Due_Date__c> TODAY() ), TEXT(ABS(TODAY() - Pay_Due_Date__c)) & " Days Overdue", IF( AND( ISPICKVAL(Pay_Stage__c, "Invoice" ),Pay_Due_Date__c = TODAY() ), "Today is Duedate","" )))

You should learn more about Formula from this link:
http://resources.docs.salesforce.com/232/18/en-us/sfdc/pdf/salesforce_useful_formula_fields.pdf


If you find your Solution then mark this as the best answer.


Thank you!


Regards,
Suraj Tripathi