Written by Allen Wyatt (last updated July 8, 2023)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, 2021, and Word in Microsoft 365
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, 2021, and Word in Microsoft 365. You can find a version of this tip for the older menu interface of Word here: Can't Merge Alphanumeric Data Correctly.
The First and Last Word on Word! Bestselling For Dummies author Dan Gookin puts his usual fun and friendly candor back to work to show you how to navigate Word 2013. Spend more time working and less time trying to figure it all out! Check out Word 2013 For Dummies today!
When creating a mail merge document, you use merge fields to indicate where the information from each record of your data ...
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 MoreThe mail-merge feature in Word is a fast, easy way to create form letters addressed to many different people. Sometimes, ...
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 © 2025 Sharon Parq Associates, Inc.
Comments