Please Note: This article is written for users of the following Microsoft Word versions: 97, 2000, 2002, and 2003. If you are using a later version (Word 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Word, click here: Can't Merge Alphanumeric Data Correctly.

Can't Merge Alphanumeric Data Correctly

Written by Allen Wyatt (last updated October 19, 2021)
This tip applies to Word 97, 2000, 2002, and 2003


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; Dave got the numbers (or underlines when the field was blank). Then his data changed and he had job and truck numbers with alphanumeric characters. When doing the merge, the number 0 displayed in the merge in any place where the job or truck number contained alphanumerics. 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 modify, slightly, 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. Beginning with Word 2002 (well, with Office XP really), Microsoft changed which "end" of the merge pair was responsible for formatting. When merging from Excel, it used to be that Excel was responsible for formatting. Beginning with Office XP, the responsibility shifted to Word. This means that the complexity of the merge fields can increase dramatically in order to get the desired results.

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 (312) applies to Microsoft Word 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Word (Word 2007 and later) 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

Printing a Key Assignment List

When you create custom shortcut keys in Word, you may (at some point) want to get a printout of what those key ...

Discover More

Locating Locked Fields

A field can be locked or unlocked, and its condition controls whether it is updated automatically or not. If you want to ...

Discover More

Using a Custom Format to Add Dashes

Want some dashes automatically added in values you display in a cell? It may be trickier to develop a custom format than ...

Discover More

Learning Made Easy! Quickly teach yourself how to format, publish, and share your content using Word 2013. With Step by Step, you set the pace, building and practicing the skills you need, just when you need them! Check out Microsoft Word 2013 Step by Step today!

More WordTips (menu)

Maintaining Leading Zeroes

When merging ZIP Codes from a data source such as Excel, you might find that Word ends up dropping out leading zeroes in ...

Discover More

Data Source File in Word 2003

The security features introduced in Word 2003 resulted in a change in the dialog boxes you see when opening mail-merge ...

Discover More

Getting Rid of Spaces in Merged Data

When you merge information with a Word document, you may not be completely satisfied with the appearance of some of the ...

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 one less than 9?

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 menu interface (Word 97, Word 2000, Word 2002, or Word 2003)? This site is for you! If you use a later version of Word, visit our WordTips site focusing on the ribbon 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.