
I currently have a formula for Contract duration (months) which will populate once the user has entered the Start and End dates into date fields.
Current Formula:
((YEAR(End_date__c ) - YEAR(Start_Date__c)) * 12) + (MONTH(End_date__c ) - MONTH(Start_Date__c )) + 1
This formula only works for start date at the start of the month, for example:
Start Date: 01/06/18
End Date: 31/05/19
Contract Duration: 12 (months)
However, this formula does not work for the following dates:
Start Date: 05/06/18
End Date: 04/06/18
Contract length should equal to 12 months however, comes out as 13 months instead.
7 件の回答
Try this, IF(
CEILING((EndDate- StartDate) / 365 * 12) < 1, 1, CEILING((EndDate- StartDate) / 365 * 12)
)
Reference link: https://success.salesforce.com/answers?id=90630000000CyvHAAS
Kindly use API names od date fields.