Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021. 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: Can't Merge Alphanumeric Data Correctly.

Can't Merge Alphanumeric Data Correctly

Written by Allen Wyatt (last updated July 8, 2023)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021


Dave is having a problem getting data in an Excel worksheet to merge successfully into a Word document. The original Excel file had fields like Job Number and Truck Number. In the merge file, he wanted the value of these fields to display unless the field was blank, in which case he wanted some underscore characters displayed. Dave used the following as his merge field:

{IF{MERGEFIELD Job_Number}="" "________" "{MERGEFIELD Job_Number}"}

When both the Job Number or Truck Number fields used the General format and contained only digits, this worked fine. Then his data changed and he had job and truck numbers with alphanumeric characters. When doing the merge, if the job or truck number contained alphanumerics, then the number 0 displayed in the merge instead of the correct digits or underscores. Thus, the merges now produced 0 in place of alphanumeric fields and Dave never got underlines; only numeric fields (or numeric fields formatted as Text) merge properly.

There are a couple of things Dave can try in this situation. The first is to slightly modify the merge field. If the merge is grabbing zero values instead of blanks, then you can change the test so it checks for zeroes, as shown here:

{IF{MERGEFIELD Job_Number}="0" "________" "{MERGEFIELD Job_Number}"}

Now, if Excel is really transferring zeroes in place of blank fields (or Word is interpreting blanks as zeroes), the test will be positive and you will get the underlines you want.

Another thing to check out is the formatting on the data that is being imported. A great resource on how to handle formatting in merge fields is found at this Web page:

http://www.gmayor.com/formatting_word_fields.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 (9722) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021. You can find a version of this tip for the older menu interface of Word here: Can't Merge Alphanumeric Data Correctly.

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

Odd & Even Headers and Footers

Adding a running header or footer to a document can be a nice touch. If you want, you can even tell Word to use a ...

Discover More

Entering Dates without Separators

When doing data entry into a worksheet, you might want to enter dates without the need to type the separators that are ...

Discover More

Forcing a Word to Lowercase

In the prose you create, you may have certain words you might always want to be lowercase, even at the beginning of ...

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)

Grouping Records in a Mail Merge

Need to group records in some manner when they are used in a mail merge? It can be frustrating when your records are not ...

Discover More

Conditionally Adding a Period in a Mail Merge

When merging data into a Word document, you may want to add information to the document based on an evaluation of what is ...

Discover More

Proper Comparisons for Dates in Merge Fields

How Word merges a data source with a document is controlled by merge fields. In those fields you may want to compare ...

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 four minus 0?

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.