Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields,microsoft.public.word.programming
Kathy Webster Kathy Webster is offline
external usenet poster
 
Posts: 23
Default Using OR in an IF statement

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


  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields,microsoft.public.word.programming
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Using OR in an IF statement

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



"Kathy Webster" wrote in message
...
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


  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields,microsoft.public.word.programming
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Using OR in an IF statement

See also Testing for a value in one of several fields.at
http://www.gmayor.com/formatting_word_fields.htm

--

Graham Mayor - Word MVP

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


Kathy Webster wrote:
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



  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields,microsoft.public.word.programming
Kathy Webster Kathy Webster is offline
external usenet poster
 
Posts: 23
Default Using OR in an IF statement

Perfect! thank you!
Kathy

"Peter Jamieson" wrote in message
...
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



"Kathy Webster" wrote in message
...
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




Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
which statement right , question is Choose the correct statement? how many template?when we click new doc Microsoft Word Help 1 October 16th 06 11:15 AM
which statement right , question isChoose the correct statement? how many template?when we click new doc Microsoft Word Help 1 October 15th 06 11:20 PM
If Then statement Brw Microsoft Word Help 2 June 9th 05 04:12 AM
OR statement JCSadie Mailmerge 7 April 26th 05 09:52 PM
or statement JCSadie Mailmerge 1 April 25th 05 06:54 PM


All times are GMT +1. The time now is 09:53 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"