WD: How to Specify Multiple Conditions with a Nested IF FieldLast reviewed: February 18, 1998Article ID: Q177287 |
The information in this article applies to:
SUMMARYIn a mail merge main document, you can use an IF (IF...THEN...ELSE) conditional statement to check whether one condition or multiple conditions are met. This article provides a method of nesting COMPARE statements in an IF field to test whether the desired conditions are met.
MORE INFORMATIONYou can specify multiple conditions by nesting a COMPARE field inside an IF field.
To Test Whether Multiple Conditions Are MetTo test whether multiple fields meet certain conditions, you could use an AND conditional statement in your mail merge main document similar to the following:
{ IF { = AND ( { COMPARE { MERGEFIELD Field_1 } = <Value> }, { COMPARE { MERGEFIELD Field_2 } = <Value> } ) } = 1 "<True Instructions>" "<False Instructions>"}The result of these nested COMPARE statements would be the <True Instructions> when both Field_1 and Field_2 are equal to <Value>; otherwise, the <False Instructions> would be given as the result. NOTES:
To Test Whether One Condition Is MetTo test whether one of the fields meets a particular condition, you could use an OR conditional statement in your mail merge main document similar to the following:
{ IF { = OR ( { COMPARE { MERGEFIELD Field_1 } >= <Value> }, { COMPARE { MERGEFIELD Field_2 } >= <Value> } ) } = 1 "<True Instructions>" "<False Instructions>"}The result of these nested COMPARE statements would be the <True Instructions> when either Field_1 or Field_2 is equal to <Value>; otherwise, the <False Instructions> would be given as the result. NOTES:
REFERENCESFor more information about conditional statements, click the Office Assistant, type "advanced mail merge," and then click to view "Customize documents created with mail merge." NOTE: If the Assistant is hidden, click the Office Assistant button on the Standard toolbar. If Microsoft Help is not installed on your computer, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q120802 TITLE : Office: How to Add/Remove a Single Office Program or ComponentFor additional information, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q90393 TITLE : WD: How to Use Nested IF Fields in a Print Merge Document ARTICLE-ID: Q176881 TITLE : WD: Err Msg: "Fields Are Nested Too Deeply" in a Mail Merge |
Additional query words: word97 word8 8.0 mailmerge
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |