Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365. If you are using an earlier version (Word 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Word, click here: Calculating Dates with Fields.

Calculating Dates with Fields

Written by Allen Wyatt (last updated April 27, 2019)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365


Aidan asked if it is possible to calculate dates using fields. Seems he wants a date that is two weeks in the future and thought there must be an easy way to calculate such a future date using fields. Unfortunately, there is no easy way. While Word allows you to do simple calculations using numeric values in fields, it does not allow you to perform such calculations using dates instead of numbers.

You can, however, pull dates apart into their intrinsic portions (months, days, and years), and then do your calculations, but this introduces a whole set of new problems. All of a sudden you need to be concerned with what happens when you "roll" past the end of a month or year. The math involved in doing such a calculation is not trivial. As an example, consider the following compound field:

{QUOTE "{SET Delay "14"}{SET "DaysInMonth" {IF {DATE \@ "MM"}
<> 2 {=ROUND(30.575*{DATE \@ "MM"},0)-ROUND(30.575*{= {DATE \@
"MM"} —1},0)}{IF {=MOD({DATE \@ "yy"|, 4)} > 0 "28" "29"}}}{SET
"NextMonth" {IF {DATE \@ "MM"} = 12 "1/97" "{= {DATE \@ "MM"}
+ 1}/97}}{IF {= {REF Delay} + {DATE \@ "dd"}} <= {DaysInMonth}
{DATE \@ "MMMM {= {REF Delay} + {DATE \@ "dd"}}, yyyy"}{QUOTE
"{NextMonth \@ "MMMM"} {= {REF Delay} + {DATE \@ "dd"} —
{DaysInMonth}}, {IF {DATE \@ "MM"} <> 12 {DATE \@ "yyyy"}{DATE
\@ "{= 1 + {DATE \@ "yyyy"} \# "xxxx"}" }}}}"}

This will return the date in two weeks time (specified in the first line where the Delay value is set. The drawback, of course, is the compound nature of the field—there are over 30 different fields just within this compound field! Even this implementation, as formidable as it looks, will not handle leap years correctly in all instances. (It won't handle leap years correctly in century years divisible by 400.)

Is there an easy way to calculate future dates? Yes, there is—simply use macros. With just a couple of simple instructions you can make short work out of otherwise difficult date calculations. This was covered in an earlier WordTips; you can also find information at the following Word MVP page:

http://wordmvp.com/FAQs/MacrosVBA/DateOfPrevMonth.htm

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (8660) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365. You can find a version of this tip for the older menu interface of Word here: Calculating Dates with Fields.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Understanding Click and Type

The Click and Type feature of Word allows you to use the mouse to click somewhere on a blank page, and then begin typing. ...

Discover More

Skipping Hidden Rows in a Macro

As your macro processes information in a worksheet, you may want to make sure that it skips over rows that are hidden. ...

Discover More

Format Painter Messes Up Ordinals

The Format Painter is a handy tool for quickly copying formatting from one place to another. Used incorrectly, though, ...

Discover More

Do More in Less Time! Are you ready to harness the full power of Word 2013 to create professional documents? In this comprehensive guide you'll learn the skills and techniques for efficiently building the documents you need for your professional and your personal life. Check out Word 2013 In Depth today!

More WordTips (ribbon)

Inserting a Document's Location

Once you save a document on disk, it is stored in a particular folder (or location) on that disk. You may want that ...

Discover More

Counting Fields in a Document

Need to count the number of times a particular field appears in a document? It's easy to do when you apply the techniques ...

Discover More

Forcing the Date to the Next Wednesday

Working with today's date in Word is easy. Trying to manipulate dates to come up with a future one can be an entirely ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 2 + 8?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.

Videos
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.