3

i have a formula field that returns number of months record untouched. For smaller dates (within last 3 years range) it is working fine, if the date exceeds 4 years then result is exceeding a month, which shouldn't be. Any idea is appreciated.

Here is the current logic,

FLOOR(TODAY() - Date__c) / 30.4368

Thanks!!

6

This is most probably due to leap years. You are using the average amount of days in a month, but this is not taking into account leap years.

As an alternative, consider this formula, which uses YEAR and MONTH functions instead of depending on days:

12*(YEAR(TODAY()) - YEAR(Date__c))
+
(MONTH(TODAY()) - MONTH(Date__c))

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.