Conditional Formatting
How do I apply a different format to my merge fields based on certain conditions?
This article describes how to use conditional formatting in a mail merge when you want to apply formatting to data values based on rules which you specify.
Step 1
In Google Sheets, create a new column for every conditional format required.
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. We have therefore created two additional columns called City-Blue and City-Red.
Step 2
Write the conditional logic formula in 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 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|* as you would for any other merge field.
In this example, we inserted *|City-Blue|* and *|City-Red|* next to each other with a space between each *|merge field|*.
Step 6
Apply formatting to each of the conditional *|merge fields|* by highlighting the text (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.