View Single Post
  #4   Report Post  
Posted to microsoft.public.word.tables
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Formula for number of days elapsed?

ASK fields are simply a way of gathering information to be saved in a
bookmark. If you are working with already entered data you don't need the
ASK fields
In this instance you select the date content of the cell and assign it to a
bookmark - Insert Bookmark - and name it to match the field construction
i.e. StartDate
As you are comparing this with today's date, you can change the EndDate ref
field in the first item on page 9 - Calculate the # Days Difference Between
Two Dates - to a DATE field thus :

{={SET a{=INT((14-{Date \@ M})/12)}}{SET b{={Date \@ yyyy}+4800-a}}{SET
c{={Date \@ M}+12*a-3}}{SET d{Date \@
d}}{=d+INT((153*c+2)/5)+365*b+INT(b/4)-INT(b/100)+INT(b/400)-32045}-{SET
a{=INT((14-{StartDate \@ M})/12)}}{SET b{={StartDate \@ yyyy}+4800-a}}{SET
c{={StartDate \@ M}+12*a-3}}{SET d{StartDate \@
d}}{=d+INT((153*c+2)/5)+365*b+INT(b/4)-INT(b/100)+INT(b/400)-32045}\# ,0}

Thus with startdate being the date of your report eg
StartDate (your table cell content) = 12 December 2006
Days Differencefrom the above field construction) = 10

Note that bookmark names must be unique so if you have several entries, each
one must have a different bookmarkname, so you would have to change
'StartDate' to something different for each row e.g.
A_Startdate, B_StartDate etc.

--

Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Roger Tregelles wrote:
Macropod,

Thanks for getting back to me and the link to your tutorial. I
downloaded it and read it through but am stuck on how exactly to
actually do what you talk about in the document. For example the
document states the following:
"One of the limitations of Word's formula handling in tables is its
inability to evaluate text strings, including dates. To get around
this, you need to bookmark the contents of the affected cells (not
the cells themselves) and reference those bookmarks (instead of the
cells) in the formulae. The following table demonstrates how to do
this using ASK fields to create the bookmarks:"

I have no idea how to bookmark the contents of a cell and use ASK
fields to accomplish what I need to do. Could you please point me to
somewhere on how exactly I would go about doing this. Thanks so much
for your help with this.
Roger

"macropod" wrote in message
...
Hi Roger,

Word's equivalent to Excel's NOW() function is a DATE field.
However, even with that you can't simply use something like
{={DATE}-H2}.

To see how to do this calculation and just about everything else you
might want to do with dates in Word, check out my Date Calc
'tutorial', at:
http://www.wopr.com/cgi-bin/w3t/show...?Number=249902
In particular, look at the items titled 'Calculate the # Days
Difference Between Two Dates' and 'Date Calculations in a Table'.

Cheers

--
macropod
[MVP - Microsoft Word]


"Roger Tregelles" wrote in message
...
Hi Folks,

I have a word document with a table that I use to track open
reports. In one of the columns I have the date the report was
issued and in another column I report the aging of the report by
manually calculating the number of days from the date the report
was issued to the current date. I would like to use a formula like
you can do so in Excel to do this automatically. I assumed I would
use a formula like this: NOW() - H2. However when I tried that I
got a syntax error. Any ideas on what I am doing wrong in
constructing this formula? Also, is there a easy way to tell what
cell you are currently working in? Any and all help will be greatly
appreciated. Roger Tregelles
Quality Assurance Engineer
Respironics Inc.