How to differently format merge fields based on certain conditions?
This article describes how to use conditional formatting to format data values based on rules that are specified, before a label merge.
Step 1: Create new column for every conditional format
In Google Sheets, create a new column for every conditional format required.
In the example below, conditional formatting was used in the label merge to display the city name San Francisco or Las Vegas in blue text and the city name Chicago in red text. So two additional columns called City-Blue and City-Red were created.
Step 2: Type conditional logic formula for first column
Type 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 display the city in D2, otherwise leave D2 blank.
Step 3: Type conditional logic formula for second column
Type 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 display the city in E2, otherwise leave E2 blank.
Step 4: Apply conditional logic formula in each column
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, there are only two columns where conditional formatting was applied.
Step 5: Insert conditional merge fields
In the label template, insert the conditional *|merge fields|* as for any other merge field.
In this example, *|City-Blue|* and *|City-Red|* were inserted next to each other with a space between each *|merge field|*.
Step 6: Format conditional merge fields
Format each of the conditional *|merge fields|* by highlighting the text (including the *| and |* tags) and changing the color or any other formatting option as required.
In this example, *|City-Blue|* was changed to blue text and *|City-Red|* was changed to red text.