Related topics
Advanced mail merge
Sign in with Microsoft
Sign in or create an account.
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.
Advanced mail merge

Add formulas and conditional statements

Your browser does not support video. Install Microsoft Silverlight, Adobe Flash Player, or Internet Explorer 9.

Advanced mail merge sends customized messages to large numbers of people, with formulas and conditional statements to make the contents look exactly how you want.

Want more?

Field codes in Word

Mail merge

Take mail merge to the next level

So far, we have focused primarily on the MERGEFIELD field code. But you can go a lot farther.

First, let’s add a formula.

In the current email, we ask recipients to add 6000 miles to the mileage they had, when their car was last serviced.

It may not seem like much, but asking customers to do math is a good way to lose their attention.

However, we can give them a hand by doing the math for them.

First let’s rewrite the line, so recipients only have to check their mileage.

Next, select the placeholder, delete it, and press Ctrl+F9. This adds a blank field code.

To add a formula, start by typing the equal sign. Go to the MAILINGS tab and insert the Mileage merge field.

You could also press Ctrl +F9, and type it manually. After the merge field, type +6000, and finally, add the switch to format the number with a comma.

The formula adds 6000 to the Mileage at the customers’ last service.

Press Alt+F9, and then F9 to update the field code and preview the result.

Now customers won’t have to do any math. Down here, we are offering a discount to customers with cars older than 2005.

Pretty straightforward, but we can eliminate any potential for confusion by only showing the offer to customers who qualify. And to do that, we’ll use a conditional statement - the IF field code.

First, delete the text, press Alt+F9, and then, press Ctrl+F9 to add a blank field code.

Type IF and a space, click Insert Merge Field, and select Year.

Next, type space, the less than and equals symbols, and space, and in quotation marks, type 2005.

So that takes care of the condition.

Type a space, and then set off by quotation marks, type the text that you want customers to see if the condition is true – their car is older than 2005.

Type another space, and then inside quotation marks, type the text that you want customers to see if the condition is false – their car is 2005 or newer.

We don’t have any offer for these customers, but we can put in a plug for the service department.

Press Alt+F9, and F9 to update the field code and preview the result.

Now as you click through the recipients, the text changes depending on the year of the customer’s car.

To see more about how to use formulas and conditional statements, check out the links in the course summary.

If you don’t like all the typing, there is another way to add field codes.

Click the INSERT tab, click Quick Parts, and Field.

The list on the left shows all the field codes available in Word.

Click one of them, then fill in the properties and options. When you click OK, Word inserts the field code.

However, as you can see, Word doesn’t provide an option or switch to format the number.

If you run into a situation like this, click Field Codes to view the code before Word inserts it.

Now, you can add the switch to format the number with commas, and click OK.

Up next, we’ll use field code to target the recipients.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Was this information helpful?

What affected your experience?

Thank you for your feedback!