Page 3 of 4 FirstFirst 1234 LastLast
Results 31 to 45 of 54
  1. #31
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,855
    Thanks
    0
    Thanked 177 Times in 163 Posts

    Re: Date Calculation Discussions (1.00)

    Hi greenmtnsun,

    Check out my Star Post at <post#=249902>post 249902</post#>.

    Cheers
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  2. #32
    New Lounger
    Join Date
    Mar 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date Calculation Discussions (1.00)

    Macropod,

    I want to thank you for your excellent document on how to calculate dates in Word. I was recently provided a document that I am to compile Site Survey data and return to the customer. This document has to be returned to me before the customers 60 till cutover mark.

    What I needed to do was make a field that automatically calculated this 60 day mark from the cutover date that I manually entered into the form. I tried to setup as an Excel object, it just didn't work correctly as the cutover date was listed in a Word cell. Though I had to rearrange some things I got this function to work like a charm. I had to check the "Update Links" in the print options, but I normally print these documents to .pdf so it was perfect

    Very good education as I'm sure I will be able to use this information again in the future.

    I have attached a Word doc showing SS's of the formula and result.

    Again, thanks...
    Attached Files Attached Files

  3. #33
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,855
    Thanks
    0
    Thanked 177 Times in 163 Posts

    Re: Date Calculation Discussions (1.00)

    Hi there,

    Thanks for the feedback. Having had a look at your attachment, I think you could do away with the additional field coded as:
    {SET aa{REF Cutover * MERGEFORMAT}}
    by replacing the four references to 'aa' with 'Cutover'. That way, there's one less bookmark to maintain.

    Cheers
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  4. #34
    New Lounger
    Join Date
    Mar 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date Calculation Discussions (1.00)

    Your correct. Replaced the "aa" with "Cutover" reference and formula still working as before. Very nice [img]/forums/images/smilies/smile.gif[/img]

  5. #35
    New Lounger
    Join Date
    Jun 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date Calculation Discussions (1.00)

    I have downloaded the document on date calculation, but am running into the problem of not being able to view the field code to adjust the future day from 301 to 1. I have gotten the following code, but am getting the error "Error! Digit Expected":

    {QUOTE
    {SET Delay 1}
    {SET a{=INT((14-{DATE @ M})/12}}
    {SET b{={DATE @ yyyy}+4800-a}}
    {SET c{={DATE @ M}+12*a-3}}
    {SET d{DATE @ d}}
    {SET jd{ =d+INT((153*c+2)/5)+365*b+INT(b/4)-INT(6b/100)+INT(b/400)-32045+Delay}}
    {SET e{=INT((4*(jd+32044)+3)/146097)}}
    {SET f{=jd+32044-INT(146097*e/4)}}
    {SET g{=INT((4*f+3)/1461}}
    {SET h{=f-INT(1461*g/4)}}
    {SET i{=INT((5*h+2)/153)}}
    {SET dd{=h-INT((153*i+2)/5)+1}}
    {SET mm{=i+3-12*INT(i/10)}}
    {SET yy{=100*e+g-4800+INT(i/10)}}
    {=dd*10^6+mm*10^4+yy #

  6. #36
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Date Calculation Discussions (1.00)

    This stuff's too complicated for me, but check out the funny quotation marks in the picture switches on the last line. Can you temporarily turn off the AutoFormat setting that changes quotation marks to "smart quotes" (under Tools>AutoCorrect Options..., "AutoFormat As You Type") and try plain ones instead?

  7. #37
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,855
    Thanks
    0
    Thanked 177 Times in 163 Posts

    Re: Date Calculation Discussions (1.00)

    Hi Kirk,

    The coding you've posted has a number of errors, on lines 3, 7 and 10.

    Line 3 is missing a ')' after '/12'.
    Line 7 has 'INT(6b/100)' instead of 'INT(b/100)'.
    Line 10 is missing a ')' after '1461'.

    The simple solution to using the code is to:
    . copy the field from the document attached to <post#=249902>post 249902</post#>
    . paste the field into your document
    . select the pasted field and press Shift-F9 to expose the code
    . change '301' to '1'
    . press F9 to update the field.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  8. #38
    New Lounger
    Join Date
    Jun 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date Calculation Discussions (1.00)

    Thanks Macropod,

    I did fix the errors, but found how to get all the code to appear from the field codes in the word doc you have for download on the original thread. It worked great until I had to make it calculate in july of 2006. If I change windows date to June 30th, it should give me July 1 for the date, but it is giving me January 7, 2006. I am getting February 7 2006 instead of July 2nd.

    I have not entered or adjusted any of the code from the word doc, except for the delay value.

    Could you shed some light on this for me.

    Thanks,
    Kirk

  9. #39
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,855
    Thanks
    0
    Thanked 177 Times in 163 Posts

    Re: Date Calculation Discussions (1.00)

    Hi Kirk,

    I suspect this is due to the code being set up for systems ussing dd-mm-yyyy date formats, whereas you're using mm-dd-yyyy. Did you follow the procedures under the heading 'Date input/output formats'?
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  10. #40
    New Lounger
    Join Date
    Jun 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date Calculation Discussions (1.00)

    I will look into that.

    Thanks a million for the help,
    Kirk

  11. #41
    New Lounger
    Join Date
    Jul 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date Calculation Discussions

    Having trouble getting the calculation that I typed (shown in the attached file) to return something other than this error message,

    Error! Digit expected.
    Attached Images Attached Images

  12. #42
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,855
    Thanks
    0
    Thanked 177 Times in 163 Posts

    Re: Date Calculation Discussions

    Hi Wabbitt,

    Welcome to the Lounge.

    It's hard to tell from the image you posted what the problem might be. Did you simply copy & paste the field from the Date Calc file? If so, it should work as is, apart from maybe having to adjust the d/m/y order at the end to suit your regional settings. Then all you'd need to do for your application of the field is to change the Delay value from '14' to '30' and change 'DATE' to 'CREATEDATE'.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  13. #43
    New Lounger
    Join Date
    Jul 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date Calculation Discussions

    Thanks for the quick response macropod! Also thanks for the welcome.

    I actually manually typed in the field so perhaps I have some issues in that. I will go back to your document and copy/paste to see if that will function as I hope. I'll let you know the success.

    Thanks again.

  14. #44
    New Lounger
    Join Date
    Jul 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date Calculation Discussions

    Well sure enough when I copy/pasted the it worked like a charm <WooHoo> that'l teach me to manually type. But at least I got to understand the code a bit better (I think ) <img src=/S/blush.gif border=0 alt=blush width=15 height=15>

    Thanks again!
    Now onto getting AutoText selection choices to work when the document is protected.

  15. #45
    New Lounger
    Join Date
    Aug 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date Calculation Discussions (1.00)

    Hi macropod...

    This document looks extraordinary. However, I may be a crystal diva, but I am a word merge newbie.

    I have taken your code for Date Calculations in a MailMerge, and clearly I am missing something significant.

    I need to get something that goes back 14 days from the "start date" - so I set the delay to -14 and substituted the name of the "start date" mergefield in place of your example, but clearly, it's not nearly that easy.

    I get an error message and nothing that remotely resembles the date I am looking for :-)

    Am I missing something?

    Rayna

Page 3 of 4 FirstFirst 1234 LastLast

Posting Permissions

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