I have an CV and would like to automatically update my age when opening. So, what formula should I insert in a MS Word field?
Something like:
{= {DATE} - {"01/01/1983"} }
I tried but could not find in Word fields the equivalent of the Excel way to substract a daytime from another one (let’s say 05/18/1983 from today 03/21/2013) which is easy in Excel since a daytime (01/01/1900 in Excel 2013) has been chosen as the beginning and every other day since is calculated according to this reference, the shown details only being a way of representing this result (full date, month in figures or its full name, or even the simple number of Excel), which can be toggled by right clicking on the cell and choosing the category cell format (since 01/01/1900 is 1, then 05/18/1983 is 30454 (...and also 00/01/1900 is 0!)).
To answer the initial question, I suggest this writing:
{= {DATE \@ "YYYY"} - my_year - 1*{=OR({={DATE \@ "MM"} < my_month};{=AND({={DATE \@ "MM"} = my_month};{={ DATE \@ "dd"} < my_day})})} \* MERGEFORMAT}
bearing in mind:
The MERGEFORMAT option is useful to keep the correct format.
Also, for those who are not used to working with Word fields:
That would do for 05/18/1983 (I changed 1st of January, which is 01/01 to 18th of avoid confusion):
{= {DATE \@ "YYYY"} - 1983 - 1*{=OR({={DATE \@ "MM"} < 05};{=AND({={DATE \@ "MM"} = 05};{={ DATE \@ "dd"} < 18})})} \* MERGEFORMAT}
This is one of the better sites for working with Word field codes - http://www.addbalance.com/usersguide/fields.htm - and there are examples there on how to create +/- dates.
Here's how you would calculate based of a birth month of January and birth year of 1983.
{IF{DATE\@"MM"} >= 01 { = {DATE\@"YYYY"} – 1983 \#"00"} { = {DATE\@"YYYY"} – 1984 \#"00"}}
Note that in the case of the month of January, this IF statement will always be true and give you =YEAR-1983. You can use another nested IF statement to check on the day to further get more accurate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With