Conditional text in address labels (Word 2011)

Yesterday, I explained how to print address labels from Apple Contacts with Word 2011. In this post, I explain how to use Word’s mail merge features to optionally add the names of your contacts’ spouses to the labels.

If you added a contact’s family members to their contact details, you probably want to address invitations, holiday cards and so on to the whole family. It is easy to add the relevant fields to the label template in the Sample Label box (the Edit Label dialog with this box appears when you click on the icon for ‘Add or remove placeholders to labels’ in the Mail Merge Manager under ‘2. Select Recipients List’):

Name  Spouse

However, in this way there appears an ugly ampersand after the names of contacts with an empty ‘spouse’ field:

Donald Duck &

It is possible to let Word’s excellent Mail Merge suppress the ampersand if the ‘spouse’ field is empty. Unfortunately, you cannot add the ‘If… Then… Else…’ field needed to do so directly in the Sample Label box.

To work around this bug, edit one of the labels in the Merge document and copy it into the Sample Label box of the Mail Merge Manager:

1) Reveal the field codes of the Merge Document by clicking on the {a} icon in the Mail Merge Manager (the ‘View all place holders’ icon under ‘Preview Results’):

View all placeholders 1

2) Choose a label in the Merge document and remove ‘ & ‘ (space ampersand space). Leave the cursor at the place of the removed text.

3) In the Mail Merge Manager, locate the If…Then…Else… place holder (under ‘More’ in section ‘3. Insert Placeholders’):

Mail Merge Manager 2

4) Click on this If…Then…Else… place holder to pop up the ‘Insert Word Field: IF’ dialog:

If spouse is not blank

5) Fill out this dialog as indicated in the picture above: If Spouse is not blank, Insert this text: & [space ampersand space], Otherwise insert this text:[empty]

6) Click ‘OK’ to insert the place holder in the Merge document.

7) Copy the modified label (except for the leading { NEXT }, but including the space after that { NEXT }!) to the clipboard:

Selection

8) In the Mail Merge Manager: open the Edit Labels dialog and replace the entire content of the Sample Label box by the clipboard (be sure to paste with styles!).

9) Click ‘OK’ to change the merge document:

View all place holders 3

10) And you are done:

Preview result

(To see this click first on the {a} icon in the Mail Merg Manager to hide the field codes, and then on then on the ABC icon to preview the labels)

11) Don’t forget to save the Merge document for future use!

Advertisements