function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Lori_Lori_ 

Calculate number of months between dates

We have a formula that assumes all policies are 12 months.  Now, we have some policies are 3 months. 
 
Since we have the policy begin dates and policy end dates, I tried "End date - Begin date".  It gives me the results in days but they want it in number of months.
 
Any suggestions?
Jeff TalbotJeff Talbot

There's so much that can be considered when calculating time between dates. A long very complex formula coupled with some validation rules could bring absolute perfection to this calculation, but that may not be necessary for your use-case.

I'd first try this simple approach:  

ROUND((End date - Begin date)/30,0)

Although the calculation isn't precise, the rounding should produce the right number of months as long as your begin and end dates are truly 3 or 12 months apart as you indicate.