Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

Question

Using if then statements in Microsoft Mail merge

Oct 4, 2011 7:03AM PDT

In MS Word 2007 I am merging a letter with names, dollar amts and addressses. I would like find a way to use a conditional statement so that if one field is blank it would use another instead. I am not familiar with this at all, except I do know its possible.

Example is if First Name is Francis, Nickname is Frank, I want to use the nickname fields when present. This is probably way too simple for this forum but I would appreciate any help someone is willing to give.

Thanks,
Mary Ellen Confused

Discussion is locked

- Collapse -
Clarification Request
if then in excel
Oct 4, 2011 11:41AM PDT

I understand, i learn stuff as I go, mail merge is a great program but it could be so much better. Can you tell me how to do it in xcel? Blush

- Collapse -
Re: if in Excel
Oct 9, 2011 4:55PM PDT

In Excel you make a new column.

Say, in row B Francis is in column 3, Frank in column 4 and your new column (headed NameToUse) is column K. Then the formula in K2 should be =if(isempty(B4),B3,B4). If B4 (nickname) is empty use B3 (first name) else use nickname.
Then drag that formula down with the copy handle (the small black square that appears in the bottom right corner of the cell if you hover your mouse there) and you'll see the column filled.
Then use that new column in your mailmerge.

Couldn't be easier.

Kees

- Collapse -
Answer
Re: mail merge
Oct 4, 2011 7:57AM PDT

If I can't do it in Word's mail merge (and I hardly ever can if it's anything more than printing a field) I do it in the source.

I happen to know how the if-statement works in both Excel (extra column) and Access (query), and I happen to not know how the it works in mail merge, because I never needed it (and if I ever read in the help didn't understand it). Same for formatting options (dates and numbers), if I don't like the default.

Probably I'm not smart enough to use this exotic part of MS Word (although I'm a programmer by profession).

Kees