# Thread: Table - Cell Formula (Word 2K)

1. ## Table - Cell Formula (Word 2K)

Have a table made in a Word 2K document. The user enters a date of birth in Cell E:5. I want Word to calculate the age (years only) and enter it in Cell H:5. Can't work it out. Any assistance is appreciated. Thanks in advance!

2. ## Re: Table - Cell Formula (Word 2K)

Conceptually, is calcuating an age as simple as "this year minus the birth year" adjusted for whether the birthdate is earlier or later than today's date? (Leap years could be messy!) I think that's easier than subtracting dates and dividing by 365 (or 366, etc.).

We've had quite a few threads on "date math" using fields. Some of the field expressions get very long and hard to understand...I'm not a whiz with this stuff. If you're interested in seeing some past solutions, try the following threads. None probably answers your question exactly, but they will give you some ideas:

Calculating Dates (Word 2000)

Date Field Codes (Word 97)

Future Dates in Fields (2000)

Date Field (97)

3. ## Re: Table - Cell Formula (Word 2K)

<P ID="edit" class=small>(Edited by macropod on 18-Dec-02 13:23. PS Added)</P>Hi,
Check out the attached.

Cell E5 has a bookmark named "BirthDate", bounded by the line feeds. You can you delete the line feeds, but you still need to make sure the birth date is input completely withing the bookmark.
Cell H5 holds the formula to calculate the age in years, which is calculated as the difference in days between the birth date and today, divided by 365.25.

Cheers

PS: The input date can be in "dd/mm/yyyy", "dd-mmm-yyyy", "m,d yyyy" etc formats - Word isn't fussy.

4. ## Re: Table - Cell Formula (Word 2K)

This field calculation is over my head, but I'm wondering if you can eliminate the need to bookmark the data cell contents by using an =

5. ## Re: Table - Cell Formula (Word 2K)

Hi Jefferson,

I tried using cell references in my formula instead of a bookmark ,but I kept getting syntax errors because the formula insisted on treating A1-style references as bookmark references. On top of that, if you put a date in one cell in a Word table and refer to it in another cell (eg = A1), what Word does is to add up all the numbers in the source cell. Thus 15 July 2001 becomes 2016, and 31 10 2001 becomes 2042! Using hypens causes the values to subtract, and using '/' generates other wierd results.

In the time I had available, I couldn't get to the bottom of these issues, so I posted a solution I knew would work, even if it is less elegant than I'd like.

Cheers

6. ## Re: Table - Cell Formula (Word 2K)

Hi Roberto,

Here's a refinement on my previous solution. Instead of using a standard bookmark for holding the BirthDate, I've used an ASK field to capture it via an inputbox, for which the answer is displayed in the same cell. Although you still have to update cell H5, you no longer have to worry about the bookmark boundaries for the BirthDate.

FWIW I also found that you could use one of Word's heading styles for cell E5 and then reference the age formula to the heading's hidden bookmark, but that approach is more difficult to set up and maintain. With the two approaches I've used, you can add more rows with age calculations, simply by displaying the fields and changing the all the bookmark names (eg to BirthDate1, BirthDate2, etc) in each row.

Cheers

7. ## Re: Table - Cell Formula (Word 2K)

My deepest gratitude for all the help and suggestions. Will let you know how it all comes out. Once again, thanks!

#### Posting Permissions

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