Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Jan 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    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. #3
    Lounger
    Join Date
    Aug 2002
    Location
    Harrisburg, Pennsylvania, USA
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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. #4
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    4,981
    Thanks
    2
    Thanked 398 Times in 328 Posts

    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
    Cheers,

    Paul Edstein
    [MS MVP - 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
  •