Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Gary Gary is offline
external usenet poster
 
Posts: 104
Default Using OR statements in an If, then, else statement

I'm trying to create an "if, then, else statement". I understand the basics
of If {mergefield XX} = "A" "Print this" "Dont print this".

How do I have the statement search for multiple criteria..If {mergefield XX}
= "A or B or C" "Print this" "Dont print this"...without having to create a
statement for each variable individually.
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Using OR statements in an If, then, else statement

Hi Gary,

Try:
{IF{={IF{MERGEFIELD XX}= "A" 1 0}+{IF{MERGEFIELD XX}= "B" 1 0}+{IF{MERGEFIELD XX}= "C" 1 0}} 0 "Print this"}
or
{IF{={IF«XX»= "A" 1 0}+{IF«XX»= "B" 1 0}+{IF«XX»= "C" 1 0}} 0 "Print this"}

Note: The field brace pairs (ie '{ }') for the above examples are created via Ctrl-F9 - you can't simply type them or copy & paste
them from this message. Likwise, you can't type the chevrons (ie '« »') - they're part of the actual mergefields, which you can
insert from the mailmerge toolbar.


--
Cheers
macropod
[Microsoft MVP - Word]


"Gary" wrote in message ...
I'm trying to create an "if, then, else statement". I understand the basics
of If {mergefield XX} = "A" "Print this" "Dont print this".

How do I have the statement search for multiple criteria..If {mergefield XX}
= "A or B or C" "Print this" "Dont print this"...without having to create a
statement for each variable individually.


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

See the example at http://www.gmayor.com/formatting_word_fields.htm -
Testing for a value in one of several fields
Instead of referring to three fields refer to the same one three times with
the three different conditions.
--

Graham Mayor - Word MVP

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



Gary wrote:
I'm trying to create an "if, then, else statement". I understand the
basics of If {mergefield XX} = "A" "Print this" "Dont print this".

How do I have the statement search for multiple criteria..If
{mergefield XX} = "A or B or C" "Print this" "Dont print
this"...without having to create a statement for each variable
individually.



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
If statements dleo Mailmerge 5 October 28th 08 03:53 PM
If then statements LSivak Mailmerge 1 November 9th 06 12:17 AM
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
Multiple "OR" statements in a single "IF" statement [email protected] Mailmerge 0 June 22nd 06 12:39 PM


All times are GMT +1. The time now is 12:17 AM.

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"