Creating an If...Then...Else rule for mail merges

J

John Salerno

Hi everyone. If I have a "Nickname" column in my data table and want to
create a rule such as this:

If <Nickname> is not blank, then use <Nickname>, else use <First Name>.

The reverse of that rule would also work. (If it's blank, use First Name,
else use Nickname.)

But how do I do this? Looking at the options for the If rules, I don't see a
way to do something this specific. It only seems you can check a data entry
and then substitute actual text, not another field value.

Thanks!
 
M

macropod

Hi Mia,

Heres how you can vary the output:
1. Make a duplicate of the nickname mailmerge field, and arrange those fields and the firstname field so that you get something
like:
«Nickname» «FirstName» «Nickname»
2. Press Ctrl-F9, to wrap a field around these, so that you get:
{ «Nickname» «FirstName» «Nickname» }
3. Fill in between the braces, paying careful attention to the spacing, so that you end up with:
{IF«Nickname»= "" «FirstName» «Nickname»}
4. Run your mailmerge.

That should give the result you're after.
 
R

Rich/rerat

John Salerno,

Try the following IF function in your Word Document, once you link your data
source to the Mail Merge document.



{if {Mergefield First_Name}<> "" "{Mergefield First_Name}" "{Mergefield
NickName}" }



You can not just type this, you will need to insert the fields into the
formula. A simple way of doing it is as follows.

1. Insert Word Field button> Choose If....Then

2. Select if first name Is Not Blank. Which will give you this in your Word
Document.

{if {Mergefield first_name}<> "" "" "" }

3. Click mouse in the center of the Second double quotes (""). From the Mail
Merge toolbar> Select Insert Mail Mergefields button, and choose "First
Name"> Apply/OK.

4. Click mouse in the center of the Third double quotes (""). From the Mail
Merge toolbar> Select Insert Mail Mergefields button, and choose "NickName">
Apply/OK.




--
Add MS to your News Reader: news://msnews.microsoft.com
Rich/rerat (RRR News) <message rule>
<<Previous Text Snipped to Save Bandwidth When Appropriate>>



Hi everyone. If I have a "Nickname" column in my data table and want to
create a rule such as this:

If <Nickname> is not blank, then use <Nickname>, else use <First Name>.

The reverse of that rule would also work. (If it's blank, use First Name,
else use Nickname.)

But how do I do this? Looking at the options for the If rules, I don't see a
way to do something this specific. It only seems you can check a data entry
and then substitute actual text, not another field value.

Thanks!
 
G

Graham Mayor

I think you have that the wrong way round?
{IF {Mergefield NickName}<> "" "{Mergefield NickName}" "{Mergefield
First_Name}" }

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
R

Rich/rerat

Graham Mayor,
Oooops, your right, cause I now see if the contact had both a first name and
a nick name, it would pull the first name, instead of using the nick name
for that contact.

Just curious is there an easy way to copy and paste a Word function formula
from a word document, to a news posting, instead of having to manually type
it out. When I tried to copy and paste the formula for this question, I got
the merge result of the formula, not the formula itself.

--
Add MS to your News Reader: news://msnews.microsoft.com
Rich/rerat (RRR News) <message rule>
<<Previous Text Snipped to Save Bandwidth When Appropriate>>


I think you have that the wrong way round?
{IF {Mergefield NickName}<> "" "{Mergefield NickName}" "{Mergefield
First_Name}" }

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Graham Mayor

My lips never moved ;)

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
R

Rich/rerat

Graham Mayor & macropod,
Thank-you both.

--
Add MS to your News Reader: news://msnews.microsoft.com
Rich/rerat (RRR News) <message rule>
<<Previous Text Snipped to Save Bandwidth When Appropriate>>


My lips never moved ;)

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
J

John Salerno

Heres how you can vary the output:
1. Make a duplicate of the nickname mailmerge field, and arrange those
fields and the firstname field so that you get something like:
«Nickname» «FirstName» «Nickname»
2. Press Ctrl-F9, to wrap a field around these, so that you get:
{ «Nickname» «FirstName» «Nickname» }
3. Fill in between the braces, paying careful attention to the spacing, so
that you end up with:
{IF«Nickname»= "" «FirstName» «Nickname»}
4. Run your mailmerge.

That should give the result you're after.

Thanks! That works great! Too bad it's rather messy (as opposed to having
this process built-in).

Now, is there some way to save this functionality so that I don't have to
re-create this each time?
 
D

Doug Robbins - Word MVP

Use Copy and Paste or create an autotext entry of the field construction.
(Actually, that is not complicated; You should see some of the other ones
that macropod comes up with.)

--
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
 
J

John Salerno

Doug Robbins - Word MVP said:
Use Copy and Paste or create an autotext entry of the field construction.
(Actually, that is not complicated; You should see some of the other ones
that macropod comes up with.)

Wow, never used AutoText before but it works great! Thanks!
 

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