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
Sujay KothapalliSujay Kothapalli 

Error: Formula result is data type Number incompatible with expected data type Date

Hi,
i am creating a new formula field with date data type.
Planned_Start_Date__c  -  Start_Date__c
Both are date fields. 
Still getting an error!!

 
Alain CabonAlain Cabon
Did you use date time values and not date values?

DATEVALUE(Planned_Start_Date__c)  - DATEVALUE(Start_Date__c)

Regards
Ashutosh GurjarAshutosh Gurjar
DATE( YEAR(Planned_Start_Date__c) -  YEAR(Start_Date__c) , MONTH(Planned_Start_Date__c) - MONTH(Start_Date__c) , DAY(Planned_Start_Date__c) -  DAY(Start_Date__c) )

you can not directly minus two date in formula field,,,this is way how to subtract two date. It will work.
If you satisfy with my answer please mark it as a best answer.
Thanks in advance