Field codes: SkipIf field

The SkipIf field compares two expressions: If the comparison is true, SkipIf cancels the current merge document, moves to the next data record (data record: A complete set of related information that corresponds to one row of information in the data source. All information about one client in a client mailing list is an example of a data record.) in the data source (data source: A file that contains the information to be merged into a document. For example, the list of names and addresses you want to use in a mail merge. You must connect to the data source before you can use the information in it.), and starts a new merge document; if the comparison is false, Microsoft Word continues the current merge document.

Documents that were created in previous versions of Word may use the SkipIf field to prevent Word from producing a merged document for particular records in the data source. However, you can select data records more easily by using the Filter command in the Mail Merge Recipients dialog box, which appears when you click Edit Recipient List in the Start Mail Merge group on the Mailings tab.

 Note   Don't use the SkipIf field with the Next field.

Syntax

When you view the SkipIf field in your document, the syntax looks like this:

{ SKIPIF Expression1 Operator Expression2 }

 Note   A field code tells the field what to show. Field results are what’s shown in the document after having evaluated the field code. To toggle between viewing the field code and the field code results, press Alt+F9.

Instructions

You can use the SkipIf field in a document or as part of a mail merge.

To use the SkipIf field in a document, do the following:

  1. On the Insert tab, in the Text group, click Quick Parts, and then click Field.
  1. In the Field names list, select SkipIf.
  2. In the Field codes box, type the expressions, operator, true text, and false text, following the syntax shown above.
  3. Click OK.

To use the SkipIf field as part of a mail merge, do the following while you are setting up the mail merge:

  1. On the Mailings tab, in the Write & Insert Fields group, click Rules, and then click Skip Record If.
  1. In the Field name list, select the name of a merge field, such as City.
  2. In the Comparison list, select the operator that you want. For example, to single out recipients in a particular city, select Equal to.
  3. In the Compare to box, type the value that you want to use. For example, to single out recipients in Tokyo, type Tokyo.

 Note   If you selected is blank or is not blank in the Comparison list, leave the Compare to box empty.

Properties

Expression1, Expression2

Values that you want to compare. These expressions can be merge field data, bookmark (bookmark: A location or selection of text in a file that you name for reference purposes. Bookmarks identify a location within your file that you can later refer or link to.) names, strings of characters, numbers, nested fields that return a value, or mathematical formulas. If an expression contains spaces, enclose the expression in quotation marks.


 Notes 

  • If you use a merge field (MergeField) in an expression, the merge field refers to data in the current data record, not in the next data record.
  • Expression2 must be enclosed in quotation marks so that it is compared as a character string.
  • If the operator is = or <>, Expression2 can contain a question mark (?) to represent any single character or an asterisk (*) to represent any string of characters.
  • If you use an asterisk in Expression2, the portion of Expression1 that corresponds to the asterisk and any remaining characters in Expression2 cannot exceed 128 characters.

Operator

Comparison operator. Insert a space before and after the operator.

Operator Description
= Equal to
<> Not equal to
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to

Example

When you insert the following SkipIf field into a mail merge main document (main document: In a mail-merge operation in Word, the document that contains the text and graphics that are the same for each version of the merged document, for example, the return address or salutation in a form letter.), the SkipIf field examines the contents of the Order field in the current data record. If the Order field contains a number less than 100, no merged document is produced for that data record.

{ SKIPIF { MERGEFIELD Order } < 100 }

Top of Page Top of Page

 
 
Applies to:
Word 2013, Word 2010, Word 2007