Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365. If you are using an earlier version (Word 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Word, click here: Age Calculation with Fields.

Age Calculation with Fields

Written by Allen Wyatt (last updated January 9, 2021)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365


2

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 pair of braces in this sample represents a new field. Thus, to put in the entire compound field, you will need to press Ctrl+F9 a total of four times. This can get a bit complex, as you cannot copy what is shown above and paste it into your document. Instead, you need to type it all in. For instance, here are the first few steps:

  1. Position the insertion point where you want the field to be inserted.
  2. Press Ctrl+F9. This inserts a pair of field braces—your first pair. At this point the insertion point should be positioned between the opening and closing brace.
  3. Type the first few characters, = INT(. You are now ready to put in your second set of field braces.
  4. Press Ctrl+F9. Word adds your second pair of field braces, and the insertion point should be positioned within this second set.
  5. Type the next few characters, DATE \@ "yyyy".
  6. Press the Right Arrow a couple of times to move to the right of the closing brace for your second field.
  7. Type the plus sign (+).

As I said, these are only the first few steps, but it should give you the general idea of how this compound field should be entered—you can't paste it; you must type it. Examine the compound field shown above and note everywhere that a pair of {braces} occurs—those are field braces and MUST be entered by pressing Ctrl+F9, as illustrated in the steps above.

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 compound field (by selecting it all and pressing F9), it is replaced with a number representing the number of years between the base date and today.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (9541) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365. You can find a version of this tip for the older menu interface of Word here: Age Calculation with Fields.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Error Opening Second Workbook

If you try to open a second workbook and you see an error message, it could be because of the way you are opening the ...

Discover More

Forcing a Worksheet to be Protected Again

Excel allows you to protect your worksheets so they can only be changed as you want to have happen. If you unprotect a ...

Discover More

Replacing the Style of a Paragraph that Follows a Heading

Do you need to change the style assigned to a paragraph depending on the style of the previous paragraph? This is the ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More WordTips (ribbon)

Inserting a Document's Size

Want to insert the size of your document directly into the document body? You can do so by using one of the dynamic ...

Discover More

Updating Fields in Locked Forms

Updating form fields in Word can be confusing, especially when the fields are locked in a form. This tips explains why ...

Discover More

Manual Line Breaks in STYLEREF Results

The STYLEREF field returns all the text referenced by a given style. When the text includes special characters, such as a ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 5 - 5?

2024-01-23 05:04:40

Douglas

Does not work.


2022-08-06 15:05:48

JohnB

On my PC (Surface Pro 5) it seems like I have to use CTRL-FN-F9 to open the braces.


This Site

Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.

Videos
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.