Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
JoePineapples JoePineapples is offline
external usenet poster
 
Posts: 1
Default Word 2000 Mailmerge - Display Field if two criteria met

Hi All

I can use the IF function for one criteria but is it possible to have two
criteria.

eg.

IF {Criteria1} = x AND {Criteria2} = y THEN Show Field

Any help would be much appreciated.


  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Word 2000 Mailmerge - Display Field if two criteria met

There are a few possible approaches, e.g. the "obvious" one:

{ IF {Criteria1} = x "{ IF { Criteria2} = y "{ the field you want }" "" }"
"" }

In some cases you may be able to combine the criteria in a useful way, e.g.

{ IF "{Criteria1}{Criteria2 }" = "xy" "{ the field you want }" "" }

(that's a string concatenation, not a multiplication. In that case it
wouldn't be helpful if Criteria1 could be "xy" and Criteria2 could be "",
for example)

Or you can use a number of types of calculation, e.g.

{ IF {={ COMPARE { Criteria1} = x }+{ COMPARE { Criteria2 } = y } } = 2 "{
the field you want }" "" }

{ IF {=AND({ COMPARE { Criteria1} = x },{ COMPARE { Criteria2 } = y }) } = 1
"{ the field you want }" "" }


--
Peter Jamieson
http://tips.pjmsn.me.uk

"JoePineapples" wrote in message
...
Hi All

I can use the IF function for one criteria but is it possible to have two
criteria.

eg.

IF {Criteria1} = x AND {Criteria2} = y THEN Show Field

Any help would be much appreciated.



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Word 2000 Mailmerge - Display Field if two criteria met

BTW, each pair of {} needs to be the special fild braces that you can enter
using ctrl-F9. You can't use the ordinary {} keyboard characters.

--
Peter Jamieson
http://tips.pjmsn.me.uk

"Peter Jamieson" wrote in message
...
There are a few possible approaches, e.g. the "obvious" one:

{ IF {Criteria1} = x "{ IF { Criteria2} = y "{ the field you want }" "" }"
"" }

In some cases you may be able to combine the criteria in a useful way,
e.g.

{ IF "{Criteria1}{Criteria2 }" = "xy" "{ the field you want }" "" }

(that's a string concatenation, not a multiplication. In that case it
wouldn't be helpful if Criteria1 could be "xy" and Criteria2 could be "",
for example)

Or you can use a number of types of calculation, e.g.

{ IF {={ COMPARE { Criteria1} = x }+{ COMPARE { Criteria2 } = y } } = 2
"{ the field you want }" "" }

{ IF {=AND({ COMPARE { Criteria1} = x },{ COMPARE { Criteria2 } = y }) } =
1 "{ the field you want }" "" }


--
Peter Jamieson
http://tips.pjmsn.me.uk

"JoePineapples" wrote in message
...
Hi All

I can use the IF function for one criteria but is it possible to have two
criteria.

eg.

IF {Criteria1} = x AND {Criteria2} = y THEN Show Field

Any help would be much appreciated.




  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Word 2000 Mailmerge - Display Field if two criteria met

HI JoePineapples,

Here's another way of approaching the problem, assuming your criteria are mergefields:
{IF{={IF{MERGEFIELD Criteria1}= x 1 0}*{IF{MERGEFIELD Criteria1}= y 1 0}= 1 "True Output" False Output"}
The same technique works with other REF fields, etc., also.

FWIW you can keep expanding this with more expressions like '*{IF{MERGEFIELD Criteria1}= x 1 0}' if necessary. Also,.if you wanted
to convert this to an OR test, you could simply replace the '*' with '+' and change the '= 1' to ' 0'.

Note: The field brace pairs (ie '{ }') for the above example are created via Ctrl-F9 - you can't simply type them or copy & paste
them from this message.

--
Cheers
macropod
[MVP - Microsoft Word]


"JoePineapples" wrote in message
...
Hi All

I can use the IF function for one criteria but is it possible to have two
criteria.

eg.

IF {Criteria1} = x AND {Criteria2} = y THEN Show Field

Any help would be much appreciated.



  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Word 2000 Mailmerge - Display Field if two criteria met

Oops! Try:
{IF{={IF{MERGEFIELD Criteria1}= x 1 0}*{IF{MERGEFIELD Criteria1}= y 1 0}}= 1 "True Output" "False Output"}

--
Cheers
macropod
[MVP - Microsoft Word]


"macropod" wrote in message ...
HI JoePineapples,

Here's another way of approaching the problem, assuming your criteria are mergefields:
{IF{={IF{MERGEFIELD Criteria1}= x 1 0}*{IF{MERGEFIELD Criteria1}= y 1 0}= 1 "True Output" False Output"}
The same technique works with other REF fields, etc., also.

FWIW you can keep expanding this with more expressions like '*{IF{MERGEFIELD Criteria1}= x 1 0}' if necessary. Also,.if you wanted
to convert this to an OR test, you could simply replace the '*' with '+' and change the '= 1' to ' 0'.

Note: The field brace pairs (ie '{ }') for the above example are created via Ctrl-F9 - you can't simply type them or copy & paste
them from this message.

--
Cheers
macropod
[MVP - Microsoft Word]


"JoePineapples" wrote in message
...
Hi All

I can use the IF function for one criteria but is it possible to have two
criteria.

eg.

IF {Criteria1} = x AND {Criteria2} = y THEN Show Field

Any help would be much appreciated.




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
Mailmerge from Excel document with multiple criteria selections ne tfarley Mailmerge 1 March 22nd 08 11:31 AM
WORD 2000 mailmerge won't work when OS converted from 2000 to XP Hoardling Mailmerge 1 January 14th 08 09:01 PM
Entering criteria value in mailmerge CQD Mailmerge 0 November 1st 05 09:58 PM
Word 2000 / Excel 2000 Mailmerge Sandra Jackson via OfficeKB.com Mailmerge 0 June 17th 05 11:40 PM
Conditionally display a paragraph using a MailMerge field? Dave Mailmerge 2 December 8th 04 01:15 AM


All times are GMT +1. The time now is 06:04 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"