Need to create a formula to calculate number of days between two date fields across objects.

I have created a formula field to calculate the number of days between two date fields:

Date Type = formula
Result = Number 
dummy__r.dummy_date__c - DATEVALUE( CreatedDate )

But this formula is not providing a value.

  • Is there a relation between the two objects?
    – human
    Dec 12, 2014 at 7:45
  • It is lookup relation between objects .
    – nam
    Dec 12, 2014 at 8:40

3 Answers 3


Formula = (FieldValue1) - (FieldValue2).

You have to ensure that the FieldValue1 and FieldValue2 are of same type i.e.

  1. Both should be DateTime or
  2. Both should be Date or
  3. Both should be number.

You can always format your field into a valid Date format:

DATE(YEAR(field__c), MONTH(field__c), DAY(field__c))

To calculate the number of days you can just deduct days:

DaysField1 - DaysField2

It should be simple then:

Object1.date - objects2.date

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .