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
Arbi LlaveshiArbi Llaveshi 

Error: Formula result is data type (Number), incompatible with expected data type (Text).

IF(ISPICKVAL(StageName, "CLOSED_WON:_INACTIVE") , DATEVALUE(LastModifiedDate) - CloseDate, null)
Best Answer chosen by Arbi Llaveshi
badibadi
You have created the formula field of type Text and the results of your formula field is a number. 
To fix this you have to either change the "Formula Return Type" to Number or change the formula to 
IF(ISPICKVAL(StageName, "CLOSED_WON:_INACTIVE") , TEXT(DATEVALUE(LastModifiedDate) - CloseDate) , null)
 

All Answers

Arbi LlaveshiArbi Llaveshi
Can anyone tell me what's wrong with this formula and how it can be fixed? 
badibadi
You have created the formula field of type Text and the results of your formula field is a number. 
To fix this you have to either change the "Formula Return Type" to Number or change the formula to 
IF(ISPICKVAL(StageName, "CLOSED_WON:_INACTIVE") , TEXT(DATEVALUE(LastModifiedDate) - CloseDate) , null)
 
This was selected as the best answer
vigivigi
please append text method and try that, 
IF(ISPICKVAL(StageName, "CLOSED_WON:_INACTIVE") , Text(DATEVALUE(LastModifiedDate) - CloseDate), null)
Arbi LlaveshiArbi Llaveshi
Thank you guys so much!