ChrisFaye1
6 years agoQrew Cadet
Counting Months based on two date field with rounding
Hi,
Need some help with a formula to count the number of months by referencing start and end date fields. I need this to round to the nearest whole number. The formula I'm currently using is below.
The issue with this formula is that it doesn't equal the proper number of months when the end date-month doesn't match the beginning date-month... it shows up as 1 less.
Ex: 11-01-19 to 10-31-20 = 11 instead of 12 months
But it functions correctly when counting 11-02-19 to 11-01-20 as 12 Months
Background: This is regarding lease dates and should round the months to the nearest whole number. Ex: If a few days short of 12 months, should still show 12 months. The rounding split can be the standard halfway mark.
Any help with this one would be amazing!
Thank You!
var date SD=[Actual: Lease Start Date];var date ED=[Actual: Lease End Date];
var number NumMonths =
(Year($ED)-Year($SD)-1)*12 + If(Month($ED)>=Month($SD),12,0) + If((Month($ED)>=Month($SD)),
Month($ED)-Month($SD),
12+Month($ED)-Month($SD));
$NumMonths
Need some help with a formula to count the number of months by referencing start and end date fields. I need this to round to the nearest whole number. The formula I'm currently using is below.
The issue with this formula is that it doesn't equal the proper number of months when the end date-month doesn't match the beginning date-month... it shows up as 1 less.
Ex: 11-01-19 to 10-31-20 = 11 instead of 12 months
But it functions correctly when counting 11-02-19 to 11-01-20 as 12 Months
Background: This is regarding lease dates and should round the months to the nearest whole number. Ex: If a few days short of 12 months, should still show 12 months. The rounding split can be the standard halfway mark.
Any help with this one would be amazing!
Thank You!
var date SD=[Actual: Lease Start Date];var date ED=[Actual: Lease End Date];
var number NumMonths =
(Year($ED)-Year($SD)-1)*12 + If(Month($ED)>=Month($SD),12,0) + If((Month($ED)>=Month($SD)),
Month($ED)-Month($SD),
12+Month($ED)-Month($SD));
$NumMonths