# Thread: IF with AND or OR in test expression (2000 or 2003)

1. ## IF with AND or OR in test expression (2000 or 2003)

Can one construct an IF function in Word that incorporates AND or OR?

I would like to construct IF statements that say:

If Bookmark A = Yes OR Bookmark B = Yes enter Bookmark C otherwise enter Bookmark D

If Bookmark X = Yes AND Bookmark Y = Yes enter Bookmark Z otherwise enter Bookmark P.

Dave

2. ## Re: IF with AND or OR in test expression (2000 or 2003)

You can use nested IF fields.

To simulate an OR condition:

{ IF { A } = "Yes" { C } { IF { B } = "Yes" { C } { D } } }

To simulate an AND condition:

{ IF { X } = "Yes" { IF { Y } = "Yes" { Z } { P } } { P } }

Note: as always, the field brackets { } should not be typed; use Insert | Field... or Ctrl+F9 to create a field.

3. ## Re: IF with AND or OR in test expression (2000 or 2003)

You can also use a combination of IF fields, =(Formula) fields with the AND or OR functions, and COMPARE fields, but these can be tricky to set up. Nested IF fields are generally easier to understand and set up correctly.

"If Bookmark A = Yes OR Bookmark B = Yes enter Bookmark C otherwise enter Bookmark D" looks like
{ IF { = OR ( { COMPARE { A } = "Yes" } , { COMPARE { B } = "Yes" } ) } = 1 "{ C }" "{ D }" }

"If Bookmark X = Yes AND Bookmark Y = Yes enter Bookmark Z otherwise enter Bookmark P" looks like
{ IF { = AND ( { COMPARE { X } = "Yes" } , { COMPARE { Y } = "Yes" } ) } = 1 "{ Z }" "{ P }" }

The Help topics on =(Formula), especially the available functions, and the COMPARE field have more information.

4. ## Re: IF with AND or OR in test expression (2000 or 2003)

Hi Dave,

See also <post#= 365442>post 365442</post#>, which shows how to use Word

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•