
Tips.Net > WordTips Home > Fields > Age Calculation with Fields
Summary: You may need to dynamically calculate an age within a document. You can do this by using fields, and every time the field results are updated your date will be updated. (This tip works with Microsoft Word 97, Word 2000, Word 2002, and Word 2003.)
If you desire, you can use fields to calculate an age. For instance, the field could calculate the number of years between some base date and today's date. The following compound field will do the trick:
{ = INT({ DATE \@ "yyyy" } + { DATE \@ "M" } / 12 +
{ DATE \@ "d" } / 365.25 - YYYYb - Mb / 12 - Db / 365.25) }
As those who are familiar with fields know, each of the braces in this sample represent a new field. In addition, you should replace the YYYYb, Mb, and Db placeholders with the year, month, and day of month for the base date. For instance, if your birthday were 21 June 1959, then you would replace YYYYb with 1959, replace Mb with 6, and Db with 21. When you then calculate the field (by selecting it and pressing F9), it is replaced with a number representing the number of years between the base date and today.
Tip #1008 applies to Microsoft Word versions: 97 2000 2002 2003
Great Idea! Uncover the many ways you can master the full potential of printing your documents. WordTips: Printing and Printers can help you get the most from both the printed page and your printer.
Thousands of WordTips, available for immediate download. Have all the Microsoft Word info you need, right at your fingertips. (more information...)
Ask a Word Question
Make a Comment
Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Pet Tips
Word2007 Tips
WordTips