## 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.

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.

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.

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

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

This entry was posted in Word and tagged . Bookmark the permalink.

### 23 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. Bobby says:

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

• Steve Chase says:

Bobby,
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.

Steve

• MartinG says:

Awesome!! Been looking all over the place for the answer to this!

• Steve Chase says:

Thanks Martin for the comment. That is encouraging information. Steve

3. Maureen says:

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

• Steve Chase says:

Maureen,
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”.

4. 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.

5. 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.

Thanks

• 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.

or

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)

6. George Jurgensen says:

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

7. Diane says:

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

• Steve Chase says:

Sorry, I don’t think there is a workaround to do a CC to a Word mail merge.

8. Simon says:

Steve, great and understandable explanation above. Worked straight away after searching endlessly. Thank you for that. What I am trying to get round now is when merging text onto to a form the text is too long so does not show. How can I merge the long statement and split it on two lines? Is that possible? Hence I’m filling a form but limited space on the merged document.

Simon

• Steve Chase says:

Hey Simon, I don’t know if there is a way to work with long text. I see how that would cause an issue. You should ask that question in the official Microsoft Office community forums. Just google “Microsoft Office community” and you should see a drop down for word. You have to use your Microsoft ID to post a question and then you will get a response back from a Microsoft rep asking if your inquiry is solved.

• Simon says:

Thank you Steve, will try but where do I find or get Microsoft ID?
Thank you.

• Steve Chase says: