I am not a programmer so please be gentle!

In an MS Word document I need to calculate age in years from birthdate.

I've done a lot of searching and seem to think this may work:

{QUOTE{SET by {BirthDate \@ yyyy}}
{SET bm {BirthDate \@ M}}
{SET bd {BirthDate \@ d}}
{SET yy {DATE \@ yyyy}}
{SET mm {DATE \@ M}}
{SET dd {DATE \@ d}}
{Set Years{=yy-by-(mm<bm)-(mm=bm)*(dd<bd) \# 0}}

My problem is that the above seems to refer to a field code and I have no idea how to work with this.

Please lend a guiding hand with step-by-step instructions for how to use the field code and the steps above to calculate the age in years from a birthdate.

Thanks so much!

  • This article might help.
    – harrymc
    Sep 7 at 19:36
  • Where did you get the code from? And what is the ultimate goal? Do you want to have a "BirthDate" field in your document and a "DATE" field which you populate and then you want to have a third field which calculates the age?
    – Loeli
    Sep 8 at 2:06
  • Cross-posted and answered at: answers.microsoft.com/en-us/msoffice/forum/all/… For cross-posting etiquette, please read: A Message to Forum Cross-Posters excelguru.ca/content.php?184 See also: Date Field calculation tutorial: msofficeforums.com/word/… Sep 8 at 20:16
  • Got code from answers.microsoft.com/en-us/msoffice/forum/all/… Ultimate goal: to enter the BirthDate using a dropdown calendar field to click on the BirthDate, then another dropdown calandar field to enter the DATE, and then MS Word calculates the age in years between those two dates, and only displays the age in years (not the BirthDate nor the DATE). If you can guide me through how to create all this I would be very appreciative! Thanks!
    – J-D
    Sep 9 at 20:22
  • That is not the source of your field code, which does not work. It is the location of one of your cross-posts. please read: A Message to Forum Cross-Posters excelguru.ca/content.php?184 Sep 12 at 18:28

1 Answer 1


Cross-posted at MS Office Forums as well as in the Microsoft Answers Forum. Please read guidance for cross-posters and follow that guidance.

Here is the field I posted there, based on Paul Edstein's work. The full field is there which gives you Years, Months, and days, as well. The field is based on the current date, as is your original field. Refer to Paul's tutorial for one that lets you set both beginning and end dates.

{SET sy{BirthDate \@ yyyy}}
{SET sm{BirthDate \@ M}}
{SET sd{BirthDate \@ d}}
{SET ey{Date \@ yyyy}}
{SET em{Date \@ M}}
{SET ed{Date \@ d}}
{SET md{=IF((em=2),28+(em=2)*((MOD(ey,4)=0)+(MOD(ey,400 )=0)-(MOD(ey,100)=0)),31-((em=4)+(em=6)+(em=9)+(em=11)))}}
{Set Years{=ey-sy-(em<sm)-(em=sm)*(ed<sd)}}

If you want to use complex fields, you must take the time to learn how to create and edit fields. It is not rocket science. Here is my article on the Microsoft website on Dealing with Fields in Microsoft Word.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .