Variable Data Processing in Word using Mail Merge

February 23, 2024

Creating a Variable Data Printing (VDP) in Microsoft Word, this is where you have an Excel file, or some other structured data source (CSV, TSV, any file that can be opened in Excel should work) with information of people you want to mail a letter, or labels to be printed. The reason for this is to do it quickly and with less chance of a human error from copying and pasting over from the file. You can use this for emailing out, not going over this in this post.

In this I’m using:

Microsoft Word for Mac 16.82 (under Word > About Word); The Windows version should be about the same.
A data source in format (Such as an Excel file)
If you need some test data to practice with you can use this website:
https://sqldatagenerator.com/generator#s
A letter you want to populate with personalized data, you can find samples online or create one in ChatGPT.

Data Source:

In the data source the first row should have the description such as: First Name, Last Name, etc.

If you have a line(s) above or below that, that is not needed data, such as a description of the file that is not to be mail merged remove those also. Also remove any blank rows.

Setup the data to work for the file, such as if you want to have hello first name, you’ll want to separate first and last names as two different fields. You may want to break up the address so you can use the pieces as needed, envelope, letter, if you need to bring in just one piece it’s easier to do it if it’s already broke apart, if you want to code for certain states having this as it’s own element will be needed (more on that below).

Setup for the mail merge:

Click ‘Mailings’ in the Word file you want to use for the mail merge.

Click ‘Start Mail Merge’ choose the type of merge like Letter

Click ‘Select Recipients’ select your data source.

Now to ‘insert Merge Field’ this will be from the first row of your file. Add them into the areas you need, include any formatting you need with the data such as bold.

When setup the way you like.

Click ‘Preview Results’; use the arrows to the right to see how different ones look, easier to make changes now then after you merge and print.

When everything looks correct click ‘Finish & Merge’:

‘Edit Individual Files’ this creates a new file with all the merged files in it.

‘Print Documents’ Will send them to the printer, or print to PDF.

Conditional coding:

Conditional coding is where: if the data says ‘this’ you want to show, hide or change something.

For example, we’ll change the greeting from Hello to Howdy for those in Texas.

Highlighting the words ‘Hello’ click on ‘Rules’ then down to ‘If…Then…Else’

In this menu

Select the Field name you want to have it check, in this case, ‘state’.

I’m checking just for Texas, you can select to have it not equal, greater, less than, not blank, etc. from the drop down.

In the ‘Compare to:’ I’m looking for ‘Texas’

The data I got has the state name fully spelled out, check your data to see what is being passed, it needs to be the same.

In the ‘Insert this text:’ I’m putting in what the text should say if the condition above is true. Then in the ‘Otherwise insert this text:’ is for anytime when that condition is not true, for this ‘Hello’.

When done hit ‘Preview Results’ and check for a record where it’s true ‘Texas’ and check for anytime it’s not true (any other states).

If you put in the wrong condition such as ‘TX’ to trigger then find out it should have been ‘Texas’. You can double click the word then right click in the text and select ‘Toggle Field Codes’ this will change to show the code like
{ IF { MERGEFIELD state } = “Texas” “Howdy” “Hello” }

What this is saying: it’s looking in the column (MERGEFIELD) ‘state’, if that column has the value of “Texas” then show “Howdy” if not then display “Hello”

If you don’t double click you’ll only get partial of the code where it will say something like Texas = ‘Texas’ then the rest but not show the “MERGEFIELD state” info.

Much more information on Microsoft’s site:

Related Articles

Menu Graphic for Legend of Boggy Creek

Menu Graphic for Legend of Boggy Creek

For the new 4K disc release of the movie of ‘Legend of Boggy Creek’, I helped with getting the original artwork expanded to use for the menu screen. The original art takes most of the screen but leaves some space on the left and right. To expand the sides of the image...

read more
InDesign Multiple Records per page

InDesign Multiple Records per page

This continues the Data Merge in InDesign Post For this post we’ll look at something simple like a 2-up postcard on an 8.5 x 11 inch sheet of paper. With this we’ll bring in 2 records per sheet that will have the mailing address, the back of the card will be static...

read more
Variable Data in InDesign

Variable Data in InDesign

This is the basic instructions on how to do Variable Data Printing VDP setup in InDesign. If you’re looking to do a basic letter such as in Word I have the basic instructions here. Sometimes you’ll want something more designed than a letter or just prefer to work in...

read more

Pin It on Pinterest

Share This