Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-12-2023, 09:16 AM
JohnDohe JohnDohe is offline How to use/create code in MS Word to calculate and display age in years? Windows 7 64bit How to use/create code in MS Word to calculate and display age in years? Office 2010 64bit
Novice
How to use/create code in MS Word to calculate and display age in years?
 
Join Date: Mar 2015
Posts: 7
JohnDohe is on a distinguished road
Default How to use/create code in MS Word to calculate and display age in years?

Hi!



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

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:
Redirecting

{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

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!
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create report for when a date is 3 years old Daronovitz Excel 5 11-01-2022 02:42 PM
Word 2016: How do I change a REF field code to display a reference to a Roman number as Arabic Peggy Sue Word 1 08-15-2017 09:50 PM
How to use/create code in MS Word to calculate and display age in years? Calculate average age (years) lyiio Excel 3 08-13-2017 12:12 AM
Is this possible? - Calculate and Display the date range between 2 specific dates Premier-UK Excel 2 08-18-2014 05:43 AM
How to use/create code in MS Word to calculate and display age in years? Using Field Codes to Calculate 5 years from a Date vandy Word 1 09-23-2009 11:32 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:23 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft