Article ID: 189026 - Last Review: October 4, 2002 - Revision: 1.0 WD98: How to Specify Multiple Conditions with a Nested IF FieldThis article was previously published under Q189026 On This PageSUMMARY
In 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. For additional information about evaluating MERGEFIELDS without using the COMPARE field, click the article numbers below to view the articles in the Microsoft Knowledge Base: 189018
(http://support.microsoft.com/kb/189018/EN-US/
)
WD98: How to Use Nested IF Fields in a Print Merge Document
189016
(http://support.microsoft.com/kb/189016/EN-US/
)
WD98: Err Msg: "Fields Are Nested Too Deeply" in Mail Merge
MORE INFORMATION
You can specify multiple conditions by nesting a COMPARE field inside an IF field. NOTE: To type field brackets ( { } ) in a Word document, press COMMAND+F9. To turn field codes on or off, press OPTION+F9. Testing Whether Multiple Conditions Are MetTo test whether multiple fields meet certain conditions, you can 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:
Testing Whether One Condition Is MetTo test whether one of the fields meets a particular condition, you can 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:
NOTE: If the Assistant is hidden, click the Office Assistant button on the standard toolbar. If Microsoft Help is not installed on your computer, click the following article number to view the article in the Microsoft Knowledge Base: 179216
(http://support.microsoft.com/kb/179216/EN-US/
)
OFF98: How to Use the Microsoft Office Installer Program | Article Translations
|

Back to the top
