data fields

  • Thread starter Thread starter batman
  • Start date Start date
B

batman

Hi there. I have a table and i want to enter a date, say 21/10/05 and
have other cell dates along a row update automatically in consecutive
order. eg the other cells for Monday to Friday would then update to
22/10/05, 23/10/05 etc. Any ideas on how i do this. I am assuming i
would need to use fields somehow? Thanks in advance. Adam.
 
This is best done in Excel, where you can use AutoFill. You can either embed
an Excel sheet in your Word doc or create the dates in Excel and paste them
into the Word table.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
Hi Adam,

If you bookmark the first date (eg 1stDate), a field coded as per the
following will calculate the second:

{QUOTE
{SET Delay 1}
{SET a{=INT((14-{1stDate \@ M})/12)}}
{SET b{={1stDate \@ yyyy}+4800-a}}
{SET c{={1stDate \@ M}+12*a-3}}
{SET d{1stDate \@ 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*10^6+mm*10^4+yy \# "00'-'00'-'0000"} \@ "dddd, d MMMM yyyy"}

For the thrid and subsequent dates, you can use a cut-down version of this:

{QUOTE
{SET jd{=jd+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 \# "00'-'00'-'0000"} \@ "dddd, d MMMM yyyy"}

in each case. No vba is required. Note that the field braces (ie '{ }') are
created in pairs via Ctrl-F9 - you can't just type them in. Also, to make
life easier, go to:
http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=249902
and download my date calculations tutorial. You can modify the example under
the heading "Calculate a day, date, month and year, using n (301) days
delay" to achieve the above coding. If the date format doesn't suit you
needs, read the instructions under "Date input/output formats" for
instructions on how to change it.

Cheers
PS: You might find that, after saving the document and re-opening it, the
dates will be off. That's becasue the same bookmarks are being used over and
over. The dates will correct themselves if you do anything to cause the
fields to recalculate (eg Ctrl-A followed by F9).
 
thanks heaps for your responses guys. I will try both ideas and will
let you know how i get on. Adam.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top