# Calculating month of years using n month delay

• 2014-03-19, 09:47
Gargo
Calculating month of years using n month delay
Hello,

I'm trying to figure out why I have to set my delay out an extra 12 months to get the desired delay results. If i set it out an extra 12 month its accurate for 11 out of 12 months.

I'm attempting to take a date out 1 month behind 10 years or 119 months.

If I take Decemeber 2013 and set the delay to 131 months my result is November 2023.

If I take January 2014 and add 131 month I get Decemeber 2024 instead of it being Decemeber 2023.

{QUOTE
{SET DELAY 10}
{SET m{=MOD({Mergefield\@MM}+Delay+11,12)+1}}
{SET y{=INT({Mergefield\@ yyyy}+(Delay+{Mergefield\@ M}-1)/12}}
"{m}-{y}" \@ "MMMM yyyy"}

Thank you
• 2014-03-19, 11:41
Charles Kenyon
Did you look at and use the fields at the Date Field Calculation Tutorial?

If you started from one of those fields, which one?
• 2014-03-19, 12:16
Gargo
I took the formula off page 9 under:

Calculate a month and year, using n months delay
• 2014-03-19, 18:50
macropod
Quote:

Originally Posted by Gargo
If I take Decemeber 2013 and set the delay to 131 months my result is November 2023.

If I take January 2014 and add 131 month I get Decemeber 2024 instead of it being Decemeber 2023.

Without wanting to place too fine appoint on it:
1 December 2013 + 131 months = 1 November 2024!
1 January 2014 + 131 months = 1 December 2024!
and that's what the field code returns in both cases...
• 2014-03-20, 08:52
Gargo
I missed that @ and it was causing the 13 month delay. Thank you for your resources and response. Much appreciated!

{QUOTE
{SET DELAY 10}
{SET m{=MOD({Mergefield\@MM}+Delay+11,12)+1}}
{SET y{=INT({Mergefield\@ yyyy}+(Delay+{Mergefield\@ M}-1)/12}}
"{m}-{y}" \@ "MMMM yyyy"}