Please Note: This article is written for users of the following Microsoft Word versions: 2007 and 2010. 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: Getting Rid of Blank Labels in a Filtered Merge.

Getting Rid of Blank Labels in a Filtered Merge

Written by Allen Wyatt (last updated April 20, 2018)
This tip applies to Word 2007 and 2010


Peggy experienced a problem printing merged labels from a filtered database. It seems that the labels she wanted were printing out, but the printing was also kicking out a blank label for every record filtered out of the merge.

Quite honestly, this problem should not occur in Word. If you use the standard Mail Merge Wizard, it sets up your labels so that you don't get blanks; you only get the labels you want. If you are not getting that, then the most likely culprit is the actual main document created in Word. You can try this:

  1. Open the main document—the one that you use to merge with your data.
  2. Press Alt+F9. This should display all the field codes in the document.

Merging is accomplished through the use of field codes. If the codes are incorrect, the merging is not done properly. The purpose of the Mail Merge Wizard is to get enough information from you that Word can set up the field codes properly.

When printing labels, the field codes specify where the individual bits of information go that make up each label. Your document should consist of a table, with each cell of the table responsible for a single label. What you are looking for right now is the composition of the first label, in the upper-left corner of your table. This is your base label. Every other cell in the table should look the same as this base label, with the exception of a {NEXT} field at the beginning of the label. This field, when encountered during a merge, causes Word to proceed to the next record in the source data.

If, after examining the field codes for your labels, you discover that they are not the same (with the exception of the {NEXT} field), then you need to start over and use the Mail Merge Wizard to again create your main document.

Another thing to check is the actual filtering that you are doing. If you are filtering your data records based on a non-printing field, it is possible that the filter is not functioning according to your expectations. In fact, it might not be filtering at all, and you can't tell because you never print the field on which you are filtering. Check to make sure that the filter is set up properly.

If you still run into problems, then you could check your source data. For instance, if you are using an Access database as your data source, you could define a query in Access that defines the labels you want to print. Use this query as the data source in Word for your mail merge. Thus, Word is not doing the filtering, but Access is handing Word data that has already been filtered.

Finally, you can get rid of records that have blank fields by using the {NEXTIF} field in your labels. This field code checks the contents of a specific field against a criterion that you set. If the criterion is met, then the merge proceeds to the next record in the data source. Why would you use such a field? It is very helpful if your data source contains a lot of records that are only partial—for instance, you may have data records that record a first name but not a last name. Consider the following field code, which could be placed at the beginning of a label:

{ NEXTIF { MERGEFIELD LastName }= "" }

This checks the LastName merge field, and if it is empty, the record is skipped and Word proceeds to the next record.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (11220) applies to Microsoft Word 2007 and 2010. You can find a version of this tip for the older menu interface of Word here: Getting Rid of Blank Labels in a Filtered Merge.

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

Adding a File Path and Filename

If you need to stuff the current workbook's filename and path into a cell or a header or footer, you'll appreciate the ...

Discover More

Creating Charts in VBA

Most charts you create in Excel are based on information stored in a worksheet. You can also create charts based on ...

Discover More

Adjusting Cell Margins for More White Space

Is the information in your cells too jammed up? Here are some ways you can add some white space around that information ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More WordTips (ribbon)

Can't Place Merge Field in Header of a Catalog Merge Document

Word can perform several different types of mail merge operations, and the type you choose can affect how you are able to ...

Discover More

Using Unique Document Serial Numbers

If you need to include serial numbers in your printed matter (labels, letters, documents, etc.), the best way is through ...

Discover More

Attaching Specific Files to Mail-Merge E-Mail Messages

Want to add attachments to each e-mail message created in a mail merge? Word doesn't include the capability to do this, ...

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 5 - 3?

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.