Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-15-2016, 08:21 AM
bjh894 bjh894 is offline Inserting a formula to count 30 days before and after a date in WORD table Windows 7 32bit Inserting a formula to count 30 days before and after a date in WORD table Office 2010 32bit
Novice
Inserting a formula to count 30 days before and after a date in WORD table
 
Join Date: Jun 2016
Posts: 3
bjh894 is on a distinguished road
Default Inserting a formula to count 30 days before and after a date in WORD table

I can do this in Excel with ease but after a couple hours of online research, I can't figure out how to do this in Word 2010.

I have figured out it has to be done in a table, and if I'm correct, have named the cells correctly in my description below.

I have attached a Word 2010 Docx.



I want to add a date in the yellow box in this table. R2C1

In R2C2 I want a date to automatically appear that is 30 days Before R2C1

In R2C3 I need a date to automatically appear that is 30 days After R2C1

I would be very grateful for a solution, if there is one
Attached Files
File Type: docx Date Signed.docx (15.2 KB, 21 views)
Reply With Quote
  #2  
Old 06-15-2016, 08:36 AM
Charles Kenyon Charles Kenyon is offline Inserting a formula to count 30 days before and after a date in WORD table Windows 8 Inserting a formula to count 30 days before and after a date in WORD table Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,159
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

This requires complex fields. Word is not built to do it easily.
See the Date Calculation Tutorial and download it. It should have the fields you want or something close enough you can easily modify them to meet your needs.

Last edited by Charles Kenyon; 05-18-2020 at 11:16 AM.
Reply With Quote
  #3  
Old 06-15-2016, 12:01 PM
bjh894 bjh894 is offline Inserting a formula to count 30 days before and after a date in WORD table Windows 7 32bit Inserting a formula to count 30 days before and after a date in WORD table Office 2010 32bit
Novice
Inserting a formula to count 30 days before and after a date in WORD table
 
Join Date: Jun 2016
Posts: 3
bjh894 is on a distinguished road
Default

Charles... Thank you for your help. I've read through your document several times and unfortunately, I'm not savvy enough with the underbelly of the language or the functionality of Word and was unable to figure this out. I am grateful for your assistance.
Reply With Quote
  #4  
Old 06-15-2016, 02:17 PM
Charles Kenyon Charles Kenyon is offline Inserting a formula to count 30 days before and after a date in WORD table Windows 8 Inserting a formula to count 30 days before and after a date in WORD table Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,159
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Quote:
Originally Posted by bjh894 View Post
Charles... Thank you for your help. I've read through your document several times and unfortunately, I'm not savvy enough with the underbelly of the language or the functionality of Word and was unable to figure this out. I am grateful for your assistance.
It has been a while since I've looked at this.

  1. Download the tutorial document and open it. Be sure to read through the introductory material.
  2. Find a field that looks like it does what you want. Select that field and press Alt+F9 to toggle display of field codes. You will jump in the document because it will become longer. Press your right or left arrow key to come back to your page.
  3. Look for a set Delay command or something similar. That is the number of days. You can modify that. Look to see where it is getting its original date. That is generally some sort of bookmark or one of the date fields.
  4. Remember to press Alt+F9 again when you are done looking at or modifying any fields.
The field I am looking at is:
{QUOTE{SET Delay 14}{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(b/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}-{mm}-{yy}" \@ "dddd, d MMMM yyyy"}



Again, read the introductory material, do not try to type this thing. You want to copy a field from the page as a whole and modify it.


Change Delay to 30 from 14. That will give you a Date 30 days from the current date. If you change later on "+Delay" to "-Delay" it will give you 30 days before the current date.
Reply With Quote
  #5  
Old 06-15-2016, 02:40 PM
Charles Kenyon Charles Kenyon is offline Inserting a formula to count 30 days before and after a date in WORD table Windows 8 Inserting a formula to count 30 days before and after a date in WORD table Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,159
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

See also Calculated Dates in Microsoft Word using Fields or vba.

In the field solution if you put these fields in a template and use the CreateDate field instead of the Date field when a document is created based on the template, you could have the CreateDate field, itself, as the base date and your other two dates will calculate automatically.

You may also want to look at http://gregmaxey.com/word_tip_pages/...ted_dates.html.

As you may have gathered, this is not for the faint-at-heart.
Reply With Quote
  #6  
Old 06-15-2016, 02:50 PM
bjh894 bjh894 is offline Inserting a formula to count 30 days before and after a date in WORD table Windows 7 32bit Inserting a formula to count 30 days before and after a date in WORD table Office 2010 32bit
Novice
Inserting a formula to count 30 days before and after a date in WORD table
 
Join Date: Jun 2016
Posts: 3
bjh894 is on a distinguished road
Default

It definitely is not. I again, thank you and will tackle this project again tomorrow. The short story is that I deliver a locked down Word document daily to people. There is a text form field in it where they have to manually type a date. Next to that, amid a sentence, are 2 more text fields. Hoping this process will end in those 2 fields auto-populating (30 days before and after) based on the users manual date entry. Your answers lead me to believe I don't need the table to accomplish this. I'll keep you posted, and thank you.
Reply With Quote
  #7  
Old 06-15-2016, 02:55 PM
Charles Kenyon Charles Kenyon is offline Inserting a formula to count 30 days before and after a date in WORD table Windows 8 Inserting a formula to count 30 days before and after a date in WORD table Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,159
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

I believe that you can use a bookmarked date, but I am not sure how. I think the DatePicker control could be crucial to getting the beginning date to be recognized.
Reply With Quote
  #8  
Old 06-15-2016, 05:17 PM
macropod's Avatar
macropod macropod is offline Inserting a formula to count 30 days before and after a date in WORD table Windows 7 64bit Inserting a formula to count 30 days before and after a date in WORD table Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by bjh894 View Post
I have figured out it has to be done in a table, and if I'm correct, have named the cells correctly in my description below.
No, it doesn't need to be in a table, but the attached implementation of the field codes from my tutorial with your document maintains your table.
Attached Files
File Type: docx Date Signed.docx (17.1 KB, 43 views)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #9  
Old 05-18-2020, 08:16 AM
BoatinBabe BoatinBabe is offline Inserting a formula to count 30 days before and after a date in WORD table Windows 10 Inserting a formula to count 30 days before and after a date in WORD table Office 2013
Novice
 
Join Date: May 2020
Posts: 1
BoatinBabe is on a distinguished road
Default Tutorial link is missing

Quote:
Originally Posted by Charles Kenyon View Post
This requires complex fields. Word is not built to do it easily.
See the Date Calculation Tutorial and download it. It should have the fields you want or something close enough you can easily modify them to meet your needs.
Hi Charles - this tutorial link is Dead. Do you have another that works?
Reply With Quote
  #10  
Old 05-18-2020, 11:14 AM
Charles Kenyon Charles Kenyon is offline Inserting a formula to count 30 days before and after a date in WORD table Windows 10 Inserting a formula to count 30 days before and after a date in WORD table Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,159
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Quote:
Originally Posted by BoatinBabe View Post
Hi Charles - this tutorial link is Dead. Do you have another that works?

It is one of the pinned threads in this forum!
Microsoft Word Date Calculation Tutorial


I will change the earlier posts.
For those who have not registered in this forum, a copy is also on Graham Mayor's website.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting a formula to count 30 days before and after a date in WORD table Date field - future date calculation + only business days neon4 Word 7 01-21-2016 02:21 PM
Inserting a formula to count 30 days before and after a date in WORD table How to count even exact date 90 days redza Excel 1 09-17-2013 03:36 AM
Word Count Formula clau_dos Word VBA 1 08-27-2013 02:05 PM
Make table cell active add date count date MelHerndon Word VBA 3 01-21-2013 04:23 PM
Inserting a formula to count 30 days before and after a date in WORD table Inserting a date calculated from a table cell theMikeD Word 2 09-11-2012 05:46 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:55 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft