Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, 2013, 2016, 2019, and Word in Office 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

by Allen Wyatt
(last updated March 7, 2020)

15

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. 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.

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 Office 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

Month for the Nth Sunday

Doing math with dates is quite easy in Excel. As this tip illustrates, this fact makes it easy to figure out the Nth ...

Discover More

Specifying the Behavior of the Enter Key

You type information in a cell and press Enter. What happens then? Excel allows you to specify exactly what should ...

Discover More

Underlining Quoted Text

Do you have a document in which you need to convert all the quoted text (text surrounded by quotes) to underlined text? ...

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)

Exactly Positioning Text

If you need to control exactly where text will appear on the page or relative to other text, you need to know about the ...

Discover More

Calculating Dates with Fields

Can you calculate dates using fields? Yes, but you probably don't want to except as a learning experience. An easier way ...

Discover More

Assigning a Macro to a Button in Your Text

One way you can access macros is through the use of a button, added directly into the text of your document. This is done ...

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}] 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 nine more than 5?

2017-07-20 10:12:13

Kaye A

Thank you, thank you!!! This works great on our company resumes for determining the number of years with the company and number of years in the industry. Thanks again!


2017-04-22 00:47:07

Judy Kunz

Finally got it to work! Thanks for the tip about pressing CONTROL + F9 to create the brackets. This is nifty.


2017-04-21 23:45:31

Judy Kunz

I need to create a field that calculates the age of a person and updates with each year. I am working with Word 2016 and am not very knowledgeable about how to create a field that does this from scratch. Using these instructions is not working. Can someone provide clear instructions as to how to create a custom field that does this. Thank you.


2015-05-18 12:47:59

Mario Dollschnieder

I am having a lot of difficulty with this process. Seems so straightforward in Excel but can't seem to get this. I am having difficulty trying to determine spacing from this formula and I can't get the ctrl f9 to work in the add field component of word 2013. It doesn't work. I am trying to insert the function in a table, is that the problem? if yes where should I be inserting the field?

Thanks in advance


2014-09-30 05:19:49

Ria

An alternative solution to calculate the age with fields but without the use of having to divide by 365.25.
If you put the birthdate in a DocVariable in the notation d/M/yyyy then you could use the following formula:
{IF {={IF{DATE @ "M"}>={DOCVARIABLE "Birthdate" @ "M"} 1 0}*{={IF{DATE @ "d"}>={DOCVARIABLE "Birthdate" @ "d"} 1 0}} > 0 "{={DATE @ "yyyy"}-{DOCVARIABLE "Birthdate" @ "yyyy"}}" "{={DATE @ "yyyy"}-{DOCVARIABLE "Birthdate" @ "yyyy"}-1}"}
The braces cannot be typed, but have to be inserted with CTRL+F9(starting a new field.


2014-09-22 15:37:39

Phillip

Thank you for the tip. This work great. I have question. What if I only interest in months not years. How to do this. Secondly, can the YYYYb, MB, Db replace from another input field. Thanks


2014-06-22 07:40:32

Michael Balieu

If you are using another language than english, then the 365.25 may need to be 365,25 if the language use , as decimal symbol


2014-06-08 13:35:14

awyatt

As stated at the beginning, this is a COMPOUND field. That means that every pair of { braces } you see is created by pressing Ctrl+F9.

Thus, to put in the entire compound field, you will need to press Ctrl+F9 a total of 4 times.

If you don't, you will get errors.

-Allen


2014-06-08 09:04:15

Pranab N.V.

Hi,
I get the same error "!Syntax Error, {", besides after making sure the entire syntax is on the same line.


2014-06-08 09:03:02

Pranab N.V.

Hi,

I get the same error "!Syntax Error, {" besides I made sure its on the single line.


2014-04-08 12:09:48

Ronald Pederson

Word 2010 -

1. CTRL F9 --> get { }
2. Type in { = {DATE @ "yyyy"} }
3. Highlight the whole thing and press F9 --> I get a syntax error:
!Syntax Error, {

I expected to get 2014

What am I doing wrong?


2014-04-07 13:39:36

awyatt

Pasting will do no good; you'll get errors. (Why? Because you would be pasting three lines, as it appears in the article. You need to put the thing in as a single line.)

It is better to simply insert field braces in the document (press Ctrl+F9) and then type the field as it appears in the article.

-Allen


2014-03-31 18:26:52

Terry

This does not work or the instructions are just poor


2014-03-19 09:25:23

Mark Pearson

I keep getting syntax error when pasting the formula into the Formula field


2014-03-17 09:25:00

Jane Bernal

need help inserting age calculation fields from start to finish! Please!


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.

Newest Tips
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.