Very difficult mailmerge question (Excel>Word)

M

Marbetu

Hello, I have become desperate with this job I must do at work ....
I have to print labels in Word from a huge Excel sheet with the following
fields:

name/streetaddress/POBox/City/Country
This would be easy, however, there are conditions that I just cannot get to
work.

If the POBox field is not blank, then, I want to print the following label;
name//POBox/City/Country

If the POBox field is blank, then, I want to print the following label:
name/streetaddress//City/Country

To explain otherwise, the POBox is the most important element, and it must
be printed if it is present, However, if it is blank we have to use the
street address.
HOWEVER, POBox AND streetaddress MUST NEVER BOTH appear together on the same
label. And that is where I am stuck. Can anybody help???

I would be sooooo relieved if someone could find a solution, I have been
trying to do it forever...
 
P

Peter Jamieson

Taking your requirement literally, what you need is this:

{ MERGEFIELD name }/{ IF { MERGEFIELD POBox } = "" "{ MERGEFIELD
streetaddress }/" "/{ MERGEFIELD POBox }" }/{ MERGEFIELD City }/{
MERGEFIELD Country }

where each set of {} are the special field code braces that you can
insert using ctrl-F9


Peter Jamieson

http://tips.pjmsn.me.uk
 
M

macropod

Hi Peter,

I think it would be best to provide for two localities, since it's possible the PO Box is in a different locality from the street
address (my own is). Hopefully the OP has such fields in the Excel file. Assuming that is so:
«Name»/{IF«POBox»= "" "«StreeAddr»/«StreetCity» «State» «Country» «StreetZip»" "«POBox»/«POCity» «State» «Country» «POZip»"}

The field brace pairs (ie '{ }') for the above example are created via Ctrl-F9 - they can't be typed or copied & pasted from this
message. Ditto the chevrons (ie '« »') - they're part of the actual mergefields, which can be inserted from the mailmerge toolbar.
 
M

Marbetu

Hello Peter and Macropod, that is very helpful, thank you.

I have almost got the right result, I need just to get the final bits of
formatting right, and also I would also like to better understand the process
which I will if you'd be kind enough to answer my questions below.

Could you tell me what role the quote marks ("") have? please. Sometimes
there are two sets, sometimes only one.

Are the forward slash signs for where paragraph returns should go?

And thanks very much for what you've explained already. This is really great.
 
M

macropod

Hi Marbetu,

The double quotes are always used in pairs, to denote the boundaries of each expression. Sometimes, where there are no spaces in an
expression, the double quotes can be dispensed with.

As for the forward slashes, yes, they're to indicate paragraph marks or line breaks. When coding my example with paragraph breaks,
you'd actually see:

«Name»¶
{IF«POBox»= "" "«StreeAddr»¶
«StreetCity» «State» «Country» «StreetZip»" "«POBox»¶
«POCity» «State» «Country» «POZip»"}
 

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