Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Feb 2014
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    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
    Last edited by Gargo; 2014-03-19 at 09:54.

  2. #2
    Silver Lounger Charles Kenyon's Avatar
    Join Date
    Jan 2001
    Location
    Madison, Wisconsin, Wisconsin, USA
    Posts
    1,695
    Thanks
    55
    Thanked 63 Times in 61 Posts
    Did you look at and use the fields at the Date Field Calculation Tutorial?

    If you started from one of those fields, which one?
    Charles Kyle Kenyon
    Madison, Wisconsin

  3. #3
    New Lounger
    Join Date
    Feb 2014
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I took the formula off page 9 under:

    Calculate a month and year, using n months delay

  4. #4
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,892
    Thanks
    0
    Thanked 188 Times in 172 Posts
    Quote Originally Posted by Gargo View Post
    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...
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  5. The Following User Says Thank You to macropod For This Useful Post:

    Gargo (2014-03-20)

  6. #5
    New Lounger
    Join Date
    Feb 2014
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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"}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •