Conditional Formatting

How can I apply a different format to my merge fields based on certain conditions?

In the example below, we want to use conditional formatting in our mail merge to display the city name 'San Francisco' or 'Las Vegas' in blue text and the city name 'Chicago' in red text.

Step 1

In Google Sheets, create an additional column for every conditional format you need.

In this example, we have created two additional columns called 'City-Blue' and 'City-Red'.

Step 2

Write the conditional logic formula in the formula bar of the first cell of the first column to be conditionally formatted.

In this example, the formula states that if the city in C2 is 'San Francisco' or 'Las Vegas', then show the city in D2, otherwise leave D2 blank.

Step 3

Write the conditional logic formula in the formula bar of the first cell of the second column to be conditionally formatted.

In this example, the formula states that if the city in C2 is 'Chicago', then show the city in E2, otherwise leave E2 blank.

Step 4

Apply the conditional logic formula to the rest of the cells in each column, by dragging the first cell downward from the bottom-right corner.

Repeat steps 3 and 4 for every column where conditional formatting is to be applied.

In this example, we only have two columns where conditional formatting is to be applied.

Step 5

In your merge template, insert the conditional merge fields into your document template.

In this example, we inserted *|City-Blue|* and *|City-Red|* next to each other with a space between each merge field.

Step 6

Apply the formatting you want to each of the merge fields by selecting the whole merge field (including the *| and |* tags) and changing the color or any other formatting option you wish.

In this example, we formatted *|City-Blue|* with blue text and *|City-Red|* with red text.