Word IF Then Else Rule (Mail Merge) Insert Fields

Previously in the article Word IF Then Else Rule (Mail Merge) I’ve explained how you can use the If Then Rule in Mail Merge. In that article the If Then Else Field would insert a text string based on the result of the comparison.

In this article I will explain how you can insert Field Values rather than Text Strings using the If Then Else Rule.


Example:

Assume you are sending letters to 100 recipients. In the Recipient List created for the recipients, there is an Age Field. What we want to do, is to compare the Age Field with the value 18.

  • If the recipients is older than 18 years, then we want the Age to be displayed
  • But if the recipient is younger than 18 years, we want the Text String “Under 18′ to display.

This will be the letter sent out to a 25 year old:

25 Year old Letter

and this will be a letter sent out to a 14 year old:
Under 18 Letter


Step 1:

Follow the same steps explained in the article Word IF Then Else Rule (Mail Merge).


Step 2:

After completing step 1, press Alt+F9. This is what you will see:
AltF9

The top part is the Greeting Line Field (which is irrelevant to our discussion):
Greeting Line Field
Under that line you will see this:
IF Then Else
This is the If Then Else Field:

{ IF { MERGEFIELD Age } > 18 "Over 18" "Under 18" }


The If Then Else Field:

As you can see the If Then Else Field has 3 parts:

If Statement:

This part compares the Age Field with the value 18:

IF { MERGEFIELD Age } > 18 

Result If True:

This is what will be displayed if the If Statement returns True:

"Over 18"

Result If False:

This is what will be displayed if the If Statement returns False:

"Under 18"

What we need to do is to change the Result If True value to { MERGEFIELD Age }:

{ IF { MERGEFIELD Age } > 18 { MERGEFIELD Age } "Under 18" }

By doing this, when the result of the If Statement is true, the Age of the recipient will be displayed.


Step 3:

As explained in the previous section we need to replace the text "Over 18" with the Age Field. In order to do this select and delete the text "Over 18":
Select
Deleete
While the cursor is still in that location insert the Age Field:
Insert Age Field
Insert Age Field 2
Press Alt+F9 to return the normal view:
Result
Result 2
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

One thought on “Word IF Then Else Rule (Mail Merge) Insert Fields”

  1. Harris Sable says:

    Hi – I am hoping you can help. I work in a law firm and I am trying to add to a particular WORD document.

    What the statement needs to be is. If Williamsburg County and if Deficiency is requested then “enter sentence here”

    This is what I have come up with. I just cannot get it to work correctly with other counties because I do not know how to make the statement both for Williamsburg County and if Deficiency is requested.

    { IF {MERGEFIELD Field 10} = “Williamsburg”} {IF {MERGEFIELD Field23} = “Requested” “sentence to be entered here”

    Can you help?

    Thanks!

Leave a Reply

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