How to use/create code in MS Word to calculate age?

J-D

Joined
Sep 12, 2023
Messages
1
Reaction score
0
Hi!

I am not a programmer so please ... don't be too rough on me!
biggrin.gif


In an MS Word (vintage 2010) document I need to calculate age in years from a birthdate and a chosen date.

I've done a lot of searching and hope this can work:
https://answers.microsoft.com/en-us...age-from/1f3b99d1-330e-4b2f-b3d2-77fcd39d5048

{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}}

Ultimate goal: to be able to click on a dropdown calendar field(not sure if this is the correct word to use!) to choose the BirthDate,
then use another dropdown calandar field(?) to enter a DATE, then have MS Word calculate the age in years between those two dates,
and only display the age in years (not the BirthDate nor the DATE) in the final document.

My problem is that the above code seems to refer to field code(s) and I have no idea how to work with them. Above my pay grade!

But I can follow directions
smile.gif


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

If the above code is not the "right stuff" please advise what I should use.

Thanks so much!
smile.gif
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top