How do I add conditional labels in a mail merge?

D

Dave the elder

I am printing labels to go into an address book. These labels contain phone
numbers and where a particular phone number exists, I would like the
appropriate label to print with the number (i.e., Home Phone, Cell Phone,
etc.) Can I do this in Word using a mail merge?
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?RGF2ZSB0aGUgZWxkZXI=?=,
I am printing labels to go into an address book. These labels contain phone
numbers and where a particular phone number exists, I would like the
appropriate label to print with the number (i.e., Home Phone, Cell Phone,
etc.) Can I do this in Word using a mail merge?
If I'm following you correctly, this is probably possible, although it may be a
bit tricky to set up. With which version of Word are we dealing?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
D

Doug Robbins - Word MVP

Use an If...then...Else field construction.

{ IF { MERGEFIELD HomePhone } <> "" "Home Phone: { MERGEFIELD HomePhone }"
"" }

Similarly for the other possibilities, though you may end up with blank
lines where one is not used. Such blank lines can be avoided with a more
complex (it gets quite a bit more complex) field construction.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
G

Graham Mayor

You shouldn't end up with blank lines provided you put the quotes in the
right place. Something like:

{Mergefield Last addressline}{IF{Mergefield HomePhone} <> "" "
Home Phone: {Mergefield HomePhone}"}{IF{Mergefield CellPhone} <> "" "
Cell Phone: {Mergefield CellPhone}"}{IF {Mergefield HomeFax} <> "" "
Home Fax: {Mergefield Homefax}"}etc

ie the condtion inserts the line feed *and* the field with its associated
text.

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top