3

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 '14 at 7:45
  • It is lookup relation between objects . – nam Dec 12 '14 at 8:40
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.
| improve this answer | |
1

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
| improve this answer | |
-2

It should be simple then:

Object1.date - objects2.date
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.