Word IF Then Else Rule (Mail Merge)

In this article I will explain the IF Then Else Rule used in Mail Merge.

Note: It is assumed readers are familiar with mail merge before reading this article.


What is it?

I’ve previously explained how you can add fields to a document. These fields will be replaced by a predefined set of values which is in the Recipient list. For example an Address block will be replaced by the address of each recipient or a Greeting Line will be replaced by a line greeting each recipient. So in short:

  1. You define a recipient list
  2. You define fields (Address Blocks, Greeting Lines, Merge Fields, …)
  3. These fields will be filled with data from the recipient list.

Using an If Then Else Rule you can apply conditions to what will be displayed. You can compare the value of a field with a criterion. Depending on whether the criterion is met or not you can choose what to display.

Step 1:

Create the main layout of the document and define a List of Recipients. In this example I will be using the recipient list below:
Recipient List

Step 2:

Move the cursor to the location you want the result of the If Then Else Rule to appear:
Cursor Location

Step 3:

Click on the If Then Else Rule button:
If Then Else Rule

Step 4:

In the window that opens there are 5 parts:
If Then Else Dialog

Field Name:
This is the field that will be compared with the criterion. This field is chosen from the list of recipients:
Field Name
You can choose the method for comparing the selected Field from this drop down list:
Compare to:
The value to compare the selected field to. In the figure below the age of the recipients are compared to the value 18:
Compare to

Insert this text:
This is the text that will be inserted if the comparison returns true. In the example below the age of the recipient is compared to the value 18. If the recipients age is greater than 18, the value “over 18” is inserted:
Insert this text

Otherwise insert this text:
This is the text that will be inserted if the comparison returns false. In the example below, if the age of the recipient is under 18, the text “Under 18” will be displayed:
Insert Otherwise
Over 18 Under 18

Insert Field:

Rather than inserting text strings, as shown in the example above, the result of the If Then Else Rule can be the value of a Field. For example in the previous example the If Then Else Rule could have output the age of the recipient if it was over 18, and displayed a text string if the recipients was under 18. I have explained this topic in the article below:

You can download the sample file used in this article from the link below:

See also:

If you need assistance with your code, or you are looking for a VBA programmer to hire feel free to contact me. Also please visit my website  www.software-solutions-online.com

Leave a Reply

Your email address will not be published. Required fields are marked *