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: Conditional Processing During a Mail Merge.
Written by Allen Wyatt (last updated April 25, 2023)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365
When using Word's mail merge feature, you are not limited to using only the actual data fields when putting together your merge document. Word also includes special fields that allow you to conditionally control how Word does the merging. These types of fields can be easily inserted by clicking on the Insert Word Field drop-down list on the Mail Merge toolbar. The three fields you can use for conditional processing are as follows:
You cannot use Word's conditional mail-merge fields to compare values in any record other than the current one. It would be very nice to compare the contents of a data field in the current record with the contents of the same data field in the previous record, but Word will unfortunately not allow it.
One possible workaround to this shortcoming—if you are using an Excel worksheet as your data source—is to simply copy the controlling field (column) to another column, and then offset it by one row. Here is an example:
Item | Category | OldCat | ||
---|---|---|---|---|
Dogs | 1 | |||
Cats | 1 | 1 | ||
Birds | 2 | 1 | ||
Pigs | 3 | 2 |
As Word processes each record of the data source, the value of the OldCat data field is the same as the contents of the Category data field in the previous record. Thus, you could use a compound field such as the following to check and act upon the comparison between the fields:
{IF {MERGEFIELD Category} <> {MERGEFIELD OldCat} "first text" "second text"}
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (8176) 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: Conditional Processing During a Mail Merge.
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!
Word has a great mail merge capability. Inherent in this capability is the option to send your merged documents via ...
Discover MoreWhen you use a data source to create a bunch of documents in a mail merge, you might not want to print all the documents ...
Discover MoreWant to add attachments to each e-mail message created in a mail merge? Word doesn't include the capability to do this, ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
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.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments