Using an If Statement

K

Kelly

I'm using Word 2003 and Windows XP. I have a merge document setup and one of
the fields is for the salutation. What I need to happen at the merge is when
it comes to the salutation field, if it is blank then look to another field I
have. so the statement should look something like this:

if <salutation1>=blank,<salutation2>,<salutation1>

However, I cannot figure out how to get that statement in my document. Any
help would be appreciated.
 
C

Charles Kenyon

{ if <salutation1> = "" "<salutation2>" "<salutation1>" }
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide


--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
G

Graham Mayor

Doug is correct, but he does have a tendency to assume a level of knowledge
that the questioner may not have, and in this case I think you may be
stretched to work out what he meant here. ;)

Press CTRL+F9 directly in the document, which will give you {}
Between the brackets type the text and insert the fields as he has shown, or
if you prefer manually type in the fields with CTRL+F9 for each pair of
boundaries {}
Thus
{IF {Mergefield Title} = "" "{Mergefield Salutation2}" "{Mergefield
Salutation1}"}
Then with the cursor in the field press F9 to update. This should also
switch the display.

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
D

Doug Robbins - Word MVP

I guess in this case you meant Charles.<g>

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

Oops - a senior moment :(
I don't know why I wrote Doug there. Apologies ;)

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
A

Amber

I am trying to do this it is not working for me. this is what I typed
{IF{Nickname}=blank,{First Name},{Nickname}} can you tell me what I am doing
wrong please?

Thank you
 
P

Peter Jamieson

1. let's try to go step by step.

The overview is that
a. your fields need to look like

{ IF "{ Nickname }" = "" "{ First Name }" "{ Nickname }" }

b. each pair of braces ( "{}" ) in there need to be the special field
braces that you can enter using ctrl-F9, not just the { and } characters you
can type on your keyboard. So e.g. you can do
ctrl-F9 to give you
{ }
then click inside those {} and type
IF "" = "" "" ""
to give you
{ IF "" = "" "" "" }

Then click between the first pair of "" and use ctrl-F9 again to give you

{ IF "{ }" = "" "" "" }

Then click inside the inner {} and type
Nickname

so you have

{ IF "{ Nickname }" = "" "" "" }

See where I'm going? Each pair of {} needs to be inserted using ctrl-F9.
Everything else is text you can enter on the keyboard. Also, you can use
Alt-F9 to "toggle" between a view where you see the field codes, or the
results of those field codes.

2. if your "Nickname" and "First Name" are actually columns in a mail merge
data source, then what you probably need is

{ IF "{ MERGEFIELD Nickname }" = "" "{ MERGEFIELD "First Name" }" "{
MERGEFIELD Nickname }" }
 

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