6 Replies Latest reply on Sep 13, 2017 2:27 AM by jynk

    Conditional Formatting in Data Merge




      I have a simple problem that I can't seem to get my wits around:


      I am sending a letter to a list of donors.


      This list has simple data merge fields:



      Donor Status


      However, the letterhead needs to have a different color for status. It is the same words but it's a diferent color (which fits that donor status). Is there any way to do this?


      So, in my excel it lists


      Mike Jones      Donor Status 1

      Jim Bob          Donor Status 2


      And  the header would be


      Wonderful Charity (in blue)


      Dear Mike,


      As a Donor Status 1 we appreciate your...


      (next letter)


      Wonderful Charity (in red)


      Dear Jim,


      As a Donor Status 2 we appreciate your...




      Any suggestions? A grep style seems to be the clue... but I am still clueless.




        • 1. Re: Conditional Formatting in Data Merge
          Peter Spier Most Valuable Participant (Moderator)

          You can't do this automatically during the merge, but you could probably use Find/Change afterward to restyle.

          • 2. Re: Conditional Formatting in Data Merge

            I know this thread is old, but it's still an issue, and I have accomplished this using GREP Styles. I did it with just bold but this technique could be expanded easily:


            1.  I tag the text in my original application with <b> and </b> just like HTML.

            2.  I create two Character Styles:

            • "Removed Text" (which for all practical purposes makes the text go away: it sets the point size to 0.1pt, horizontal width to 1%, and the text-color to none)
            • "Strong" (which sets the text to bold)

            3. I created the following 2 GREP styles within the paragraph style:

            • Apply Style: "Strong" To Text: <b>.+?</b>
            • Apply Style: "RemovedText" To Text: </?b>


            When I run the data merge, my bolds are bold!

            • 3. Re: Conditional Formatting in Data Merge
              Ahanses Level 1

              You could use formulas in Excel to build 2 new columns that are your actual data merge columns.  Basically, you have Excel look at the column with Donor Status and if it matches "Donor Status 1" you have it put "Wonderful Charity" in the Blue Data Merge column.  If its "Donor Status 2" you have it put "Wonderful Charity" in the Red Data Merge column


              Then in the text field in InDesign, you have something like this <<BlueDataMerge>><<RedDataMerge>>


              Since the other column is blank for each, it will only show the text in the correct color.

              • 4. Re: Conditional Formatting in Data Merge
                Colin Flashman Adobe Community Professional


                I think you've left out a GLARING detail, and that is the fields have to be assigned the appropriate character style with the relevant colours to each separate merge field, otherwise the text (which is all in the same text field) will come out the same text colour.

                • 5. Re: Conditional Formatting in Data Merge
                  Ahanses Level 1

                  So sorry, I assumed that someone who already had the knowledge that this user expressed with Data Merge would already be aware of how to set colors and stuff on merged content, especially since he already provided an image showing an example of merged content doing so...


                  So, not so GLARING, but thanks for assuming idiocy...

                  • 6. Re: Conditional Formatting in Data Merge
                    jynk Level 1

                    how did you get on with this? Is there any way to define a paragraph style or master page for a data row? Seems like this should be possible!