Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / August 2007

Tip: Looking for answers? Try searching our database.

Using OR in an IF statement

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kathy Webster - 13 Aug 2007 23:31 GMT
I want to say:  IF MERGEFIELD region = 1 or IF MERGEFIELD state = 3, then
type "You qualify."

I know how to do it if there is only 1 criteria, but can't figure out the OR
part:

{ IF MERGEFIELD region = 1 "You qualify." }

TIA,
Kathy
Peter Jamieson - 14 Aug 2007 00:14 GMT
In this case you could use

{ IF { MERGEFIELD region } = 1 "You qualify" "{ IF { MERGEFIELD state } = 3
"You qualify" "" }" }

You can also use { COMPARE }, e.g. if region = 1 then

{ COMPARE { MERGEFIELD region } = 1 }

results in 1 if region = 1 and 0 otherwise. So you can then use

{ IF "{ COMPARE { MERGEFIELD region } = 1 }{ COMPARE { MERGEFIELD state } =
3 }" <> "00" "You qualify" "" }

or if you prefer you can use an { = } field to do either an "or" or a
calculation, then test the result. The approach that is most easily extended
to more conditions is probably

{ IF { ={ COMPARE { MERGEFIELD region } = 1 } + { COMPARE { MERGEFIELD
state } = 3 } } > 0 "You qualify" "" }

All the {} need to be the special field braces that you can insert using
ctrl-F9

Peter Jamieson

>I want to say:  IF MERGEFIELD region = 1 or IF MERGEFIELD state = 3, then
>type "You qualify."
[quoted text clipped - 6 lines]
> TIA,
> Kathy
Kathy Webster - 14 Aug 2007 16:49 GMT
Perfect! thank you!
Kathy

> In this case you could use
>
[quoted text clipped - 32 lines]
>> TIA,
>> Kathy
Graham Mayor - 14 Aug 2007 07:06 GMT
See also Testing for a value in one of several fields.at
http://www.gmayor.com/formatting_word_fields.htm

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> I want to say:  IF MERGEFIELD region = 1 or IF MERGEFIELD state = 3,
> then type "You qualify."
[quoted text clipped - 6 lines]
> TIA,
> Kathy

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.