Create a mail merge with an if…then…else statement to write different messages to females and males

Microsoft Word mail merge is awesome! It is one of my favorite teaching lessons. I recently learned how to add a rule that has some conditional logic. In this post I am going to explain how you can write one message for the female customers and something different for the males. Let’s say you have a database or spreadsheet that tracks customers with a gender field. Here is a simple example of a spreadsheet that will do.

Sample data

To start a Mail Merge you need to first connect to the data source. One way is to go this route(Mailings tab–>Select Recipients–>Use existing list). Browse for data file.

Place the insertion point where you would like to add a rule. Click Rules–>If..Then..Else.

rules...if then else

Complete the IF statement connecting the field name with a comparison. For example, I would like to offer the men 70% off the purchase of mountain bikes and for that women can buy 1 purse and get 1 purse free.

if statement

Edit the doc and then choose the Finish & Merge command. You will then be on your way to something like this.

final docs

If you would like to practice on your own, here is my sample Excel if then else mailmerge workbook.

About Steve Chase

I'm a proud husband and dad to 4 boys! Microsoft Certified Trainer and Boy Scout Leader are some of things I call myself. The Cincinnati Reds are my favorite team! When not outdoors, I enjoy working with documents in Microsoft Office, QuickBooks, Visio and Photoshop. My wife, Erin, shares her awesome recipes on her blog at
This entry was posted in Word and tagged . Bookmark the permalink.

19 Responses to Create a mail merge with an if…then…else statement to write different messages to females and males

  1. Sanford says:

    I was pretty pleased to uncover this website. I want to to thank you for ones time just for this wonderful read!
    ! I definitely loved every part of it and I have you book marked
    to see new stuff in your website.

  2. Pingback: How to Send an Email Mail Merge using Word and Outlook together | Steve Chase Docs

  3. Bobby says:

    Hey Steve,
    How do I place fields, instead of text, in the if and then expressions?

    • Steve Chase says:

      You can insert fields instead of text, here’s how.
      First click on the mailings tab=>Rules=>If… Then…Else.
      Set the criteria for the If. Leave the bottom section blank for the “Insert this text:” and/or “Otherwise insert this text:” sections.
      Click the OK button.
      Press Alt+F9 to recognize the mail merge field codes.
      You will see curly brackets surrounding the if then else statement. Where you left it blank, you will see 2 double quotes. The first set is for true and the last one is false (otherwise). Place the insertion point inside the double quotes and then click the Mailing tab=>Insert Merge Field and select the field you want.

      Press Alt+F9 to toggle out of the field codes. Preview the results to verify it is working.


  4. Maureen says:

    How do I edit a rule, for example if I misspelled a word?

    • Steve Chase says:

      Right click on the place where the rule appears in the doc and select “toggle field codes”. Make the edit/ fix typo, then click again “toggle field codes”. Right click and then select “update field”.

  5. Princess says:

    Dear Steve,
    How could to set condition if , to make it continues the record data on next page, and at the end the final data wont be missed.

    • Steve Chase says:

      Can you clarify? I’m not sure I understand the task.

      • Princess says:

        sorry for my poor english but thank you for your prompt reply.
        my problem is: i made my mail merge with an admission card on a A4 size page, 1 page could then have 3 cards there. But when the first three cards data(i.e. #1-3) filled, the #4 or more data will be skipped on the coming page, finally many data were skipped , also the last data never shown on the page.

        How to set the condition in my case.

  6. Lyn says:

    Hi Steve, I am trying to make 2 IF statements in my document

    1. If Field 1 = X and Field 2 is not blank insert (“Field 2”), if Field 2 is blank then skip to next record
    2. If Field 2 is not blank insert Field 2, but if Field 2 is blank, then insert Field 1.

    No matter what I do, I can not seem to get this to work.


    • Lyn says:

      As an example

      1a. Field 1 = Lynda Field 2 = Lyn, I want to have the document have Lynda (“Lyn”) or if Field 2 is blank then only Lynda will show in my document.


      1b. Field 1 – John and Field 2 is blank I want my document to have John then continue with the sentence.

      2. Later in my document I want to have Lyn (1a.) or John (1b)

  7. George Jurgensen says:

    Can one insert a sections containing mail merge fields within the “if then else” statement?

  8. Diane says:

    Hi, Steve. Is there a workaround that will allow me to add a cc to a Word email merge?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s