![]() |
|
![]() |
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
![]()
If anyone can help me with these formulas, I would be very grateful. I can not figure out what I'm doing wrong with entering these Nested If Formulas in my word document's inserted field, and I've been trying to tweak this for about a week now with no results. I've been using the Ctrl+F9 to enter the brackets and input the code within the applicable brackets, but I guess that I might have the brackets in the wrong places maybe? Incorrect use of the space bar? I really have no idea. I have tried numerous different ways to rewrite this and none of them work.
Basically, what I'm trying to do here is have a field inserted into my Word Document which takes the date from a user fill-in field (a person's birth date entered, bookmarked as Text2) and the field in question would return the person's current and exact age in full, non-rounded years with respect to the current date. by the way, I hope I'm drafting this thread correctly, as well. Or posting it in the correct place on this forum. If I'm not please let me know, and I will try to fix it. This is my first time posting something here. The field codes that I can't figure out are as follows (verbatim): { IF { { { DATE \@ "YYYY" } - { REF Text2 \@ "YYYY" } = 70 } { IF { { { DATE \@ "MM" } <= { REF Text2 \@ "MM" } } { IF { { { DATE \@ "DD" } < { REF Text2 \@ "DD" } } { = { { DATE \@ "YYYY" } -1 } - { REF Text2 \@ "YYYY" } } { = { DATE \@ "YYYY" } - { REF Text2 \@ "YYYY" } } } } { = { DATE \@ "YYYY" } - { REF Text2 \@ "YYYY" } } } } { = { DATE \@ "YYYY" } - { REF Text2 \@ "YYYY" } } } } |
#2
|
||||
|
||||
![]()
You should change your text formfield's internal bookmark name to 'BirthDate' and use a field constructed as:
Code:
{QUOTE {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 Years{=ey-sy-(em<sm)-(em=sm)*(ed<sd)}} "{Years} Year{IF{Years}= 1 "" s}"} Note: The field brace pairs (i.e. '{ }') for the above example are all created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac); you can't simply type them or copy & paste them from this message. Nor is it practical to add them via any of the standard Word dialogues. The spaces represented in the field construction are all required. Although I've used linebreaks in the field code, they're no needed - they just add clarity. To see how to do just about everything you might want to do with dates in Word, check out my Microsoft Word Date Calculation Tutorial (which is where the above field code comes from): https://www.msofficeforums.com/word/...-tutorial.html
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Have Text Entered in Content Control / PreDefined Field Populate Field in Footer | bzowk | Word | 1 | 04-14-2016 11:50 AM |
Formula to subtract one month from due date field in reminder field | ghumdinger | Outlook | 1 | 10-01-2011 12:09 AM |
![]() |
vandy | Word | 1 | 09-23-2009 11:32 AM |
new appointment date always reverts back to today's date | msills | Outlook | 0 | 08-24-2007 08:57 AM |
![]() |
promark | Outlook | 1 | 12-23-2005 07:21 AM |