Home > Sample chapters > Microsoft Office > Word

Mailing Paper or Pixels with Microsoft Word 2013

Adding information with rules

The entries in the Insert Merge Field gallery represent only the columns that are present in the data source. In addition, you can use the fields in Word 2013 to perform comparisons and calculations during a mail merge, so you can display additional information, depending on the data in the data source.

Modify the merge with rules

  1. Insert a SET field if you want to store an unchanging number or text that can be used to perform comparisons or calculations for all of the recipients in a merge. On the Mailings tab, in the Write & Insert Fields group, click Rules and then, on the list that appears, click Set Bookmark. Continue at step 2.

  2. In the Insert Word Field: Set dialog box, type a bookmark name in the Bookmark list box, type the number or text in the Value text box, and then click OK.

    The bookmark is located inside the SET field, which doesn’t display any result in the document. However, the bookmark can be referenced in other fields elsewhere in the document, such as a REF field that will display the value, or a formula field that will use the value in a calculation.

  3. Insert an ASK field if you want to store a number or text that might be different for each recipient. On the Mailings tab, in the Write & Insert Fields group, click Rules and then, on the list that appears, click Ask. Continue at step 4.

    httpatomoreillycomsourcemspimages1565331.jpg
  4. In the Insert Word Field: Ask dialog box, type a bookmark name in the Bookmark box, type a question in the Prompt box, type a default value if desired, and then click OK.

    During the merge, the prompt will be displayed for each recipient, and the value you enter will overwrite any previous value in the bookmark. If you want to use the same value for all of the recipients during the current merge, select the Ask Once check box.

    The bookmark is located inside the ASK field, which doesn’t display any result in the document. However, the bookmark can be referenced in other fields elsewhere in the document, such as a REF field that will display the value, or a formula field that will use the value in a calculation.

    httpatomoreillycomsourcemspimages1565333.jpg
  5. If you want to display a number or text that might be different for each recipient, insert a FILLIN field. On the Mailings tab, in the Write & Insert Fields group, click Rules and then, on the list that appears, click Fill-in. Continue at step 6.

  6. In the Insert Word Field: Fill-in dialog box, type a question in the Prompt text box, type a default value if desired, and then click OK.

    The FILLIN field is similar to the ASK field, except that the FILLIN field displays its value in the document and doesn’t store its value in a bookmark.

  7. Insert an IF...THEN...ELSE field where you need to display different results in the document, depending on the value of a merge field or other field. If you want to base the decision on a bookmark value (such as one in a SET field or an ASK field), continue at step 9.

    On the Mailings tab, in the Write & Insert Fields group, click Rules and then, on the list that appears, click If...Then...Else. Continue at step 8.

    httpatomoreillycomsourcemspimages1565335.jpg
  8. In the Insert Word Field: If dialog box, select a merge field in the Field Name list box, select a condition in the Comparison box and, if necessary, enter a value in the Compare To list box. In the Insert This Text box, enter the result that the field will display if the comparison is true. In the Otherwise Insert This Text box, enter the result that the field will display if the comparison is false. Click OK.

    httpatomoreillycomsourcemspimages1565337.jpg
  9. If you want to base the decision on a bookmark value (such as one in a SET field or an ASK field), click the Insert tab. In the Text group, click Quick Parts and then click Field. Continue at step 10.

    httpatomoreillycomsourcemspimages1565339.jpg
  10. In the Field dialog box, in the Field Name list box, click If. Then, click the Options button.

    In the Field Options dialog, click the desired bookmark name and then click Add To Field. Click at the end of the expression in the Field Codes box and type the rest of the code.

    For example, suppose the selected bookmark is Quantity, and you want the result to display copy if Quantity is 1 or copies if Quantity is greater than 1. The completed code for this field is IF Quantity = 1 “copy” “copies”.

    Click OK in the Field Options dialog box and then click OK in the Field dialog box.