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
JoannaJoanna 

Custom Formula Field Problems

I am trying to create a formula field to calculate the number of days since the Last Status Changed date.  I have a custom field Last_Status_Changed__c, which is a date field.  I need to create a formula field that will calculate the number of days before today that the status was last changed.

I've looked at the Help functionality for formulas, and I found the Today() function.  But, I haven't found a Date Difference type function.  How can I create this formula field?

Thanks!
RickyGRickyG
Joanna -

You are really close.  The formula field would be a number, with a formula something like
TODAY() - DateField

Hope this helps.

JoannaJoanna
Thanks!  That worked.  I thought that's what I was trying yesterday when I was getting syntax errors, but I must have had something different.  It worked perfectly today.  Thanks again!
WhyserWhyser

I'm having a similar problem as well, I'm trying to create a formula field "Age Qualified Pending", which will show me how many days has passed before a Lead has gone into a certain status.

Qualified_Pending_Date__c -  CreatedDate

The Qualified_Pending_Date__c is a custom date field that will set when the lead reaches a certain status (thru a workflow rule).

Anyways, when I try to check the syntax on this formula, I receive this error

"Error: Incorrect parameter for function -(). Expected Number, Date, received DateTime"

I guess it doesn't like my subtraction function. Has anyone else run into this problem? Does anyone have a solution??

WhyserWhyser
Nevermind, I figured it out.
 
Turns out that you cannot subtract a datetime field with a date field.
 
To fix this formula
 
Qualified_Pending_Date__c - DATEVALUE( CreatedDate )
 
Works perfectly now.