Article ID: 189018 - Last Review: July 16, 2007 - Revision: 1.1 WD98: How to Use Nested IF Fields in a Mail Merge DocumentThis article was previously published under Q189018 On This PageSUMMARY
In Word, you can use the IF field to obtain customized mail merge results.
By nesting IF fields, as described in this article, you can obtain
conditional mail merge results and logically construct the equivalent of
Boolean AND and OR statements.
MORE INFORMATION
The IF field syntax is as follows
Conditional Mail Merge Results Using IF FieldIn the following example, each form letter requests that its recipient attend a meeting on a different date, based on the city field.Data Document: NAME, ADDRESS, CITY, STATE, ZIP Bill Brown, 123 Acorn St., Seattle, WA, 98035 Sandy Sill, 234 Ash St., Los Angeles, CA, 99888 Fred Turner, 345 Birch Ave., San Francisco, CA, 45555 Lynne Lowe, 456 Walnut St., Boise, ID, 83240
Please attend the Windows meeting on {if {city}= "Seattle"
"Tuesday, March 21." "{if {city}= "Los Angeles" "Wednesday, March
22." {if {city}= "San Francisco" "Thursday, March 23." "Friday,
March 24."}"}"}.
(for Mr. Brown) Please attend the Windows meeting on Tuesday, March 21. (for Ms. Sill) Please attend the Windows meeting on Wednesday, March 22. (for Mr. Turner) Please attend the Windows meeting on Thursday, March 23. (for Ms. Lowe) Please attend the Windows meeting on Friday, March 24. Using IF Field to Perform Boolean AND and OR OperationsThe IF field does not directly support Boolean AND and OR operations in a mail merge. However, the logical AND and OR operators are actually just abbreviations of nested IF statements; therefore, you can construct the equivalent of Boolean AND and OR operations by using the following syntax:
Constructing a Boolean AND StatementThis AND statementConstructing a Boolean OR StatementThis OR statement | Article Translations
|

Back to the top
