0

I have two custom date fields on the contract object called contract start date and contract end date that are both just date fields.

How would I write a custom formula field that looks at both and tells me the number of months for the contract?

Tried, (MONTH(EndDate)-MONTH(StartDate))/30 so far

and then (EndDate - StartDate)/30 which works sometimes but not others

4

1 Answer 1

1

I tested this formula and works fine

(
    ( (YEAR(End_Date__c ) - YEAR(Start_Date__c ) - 1) *12 ) 
    + (12 - MONTH(Start_Date__c ) +1)
    + MONTH(End_Date__c )
    - 1 
    + IF(DAY(End_Date__c ) > DAY(Start_Date__c ),1,0)
)

you can do a -1 if you will not consider the first month = 1

0

You must log in to answer this question.

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