Blank fields when merging from Excel

G

Gossipsfrolick

Hullo, I'm wondering whether someone could help me, please ? I've been
asked to help a charity working on some new computers. Although I'm more
than happy with the majority of Office, I have never had any occasion to use
Mailmerge and the majority of instructions, such as those in Help or the
Microsoft site, only seem to deal with the straight forward set-ups.

The charity works to gain sponsors for children in 3rd World areas and
writes to these sponsors periodically to keep them uptodate. The source data
document is an Excel document. Entering mailmerge fields to fill address and
salutation details are not a problem but the problems arise with inserting
the names of the children because some sponsors support as many as three
children.

"A typical sentence might run: I'm delighted to enclose a photo of
xxxxxxxxxxxxxx which we received a week ago."
In place of the xxxxxxxxxxx would be the mailmerge fields:
«Childs_first_names_1» «Childs_first_names_2» «Childs_first_names_3»


I have managed to sort out what to do if I want to insert 'and' or a comma
between the children's name ( though not how to do , between the first two
and 'and' between the second two, if there are indeed 3 children; or 'and'
between children 1 and 2 if there is no third child). However, I cannot get
rid of the space left after the first or second child's name if the next
field is blank.



I tried:

{MERGEFIELD "Childs_first_names_1"}{ If {MERGEFIELD Childs_first_names_2}<>
"" "," "" }{MERGEFIELD "Childs_first_names_2" }{If {MERGEFIELD
Childs_first_names_3}<> "" "and" "" }{MERGEFIELD "Childs_first_names_3"}



but is still leaves a small gap.



I've also investigated switches but without any degree of satisfaction.



Any help would be very much appreciated please as at the moment I'm spending
a lot of time on it and remaining stumped! The more straightforward the
answer, the better!



Thanks in anticipation.



Kate





P.S. I've tried looking through past posts but none seem exactly relevant.
 
M

macropod

Hi,

Try:

{IF{MERGEFIELD "Childs_first_names_2"}= "" {MERGEFIELD
"Childs_first_names_1"} {IF{MERGEFIELD "Childs_first_names_3"}=""
"{MERGEFIELD "Childs_first_names_1"} and {MERGEFIELD
"Childs_first_names_2"}" "{MERGEFIELD "Childs_first_names_1"}, {MERGEFIELD
"Childs_first_names_2"} and {MERGEFIELD "Childs_first_names_3"}"}}

This version of the field first tests whether there is a second child's name
and, if not, inserts only the first child's name. If there is a second
child's name, the field then tests whether there is a third child's name
and, if not, inserts only the first and second children's names - otherwise
all three names are inserted as 'child 1, child 2 and child 3'.

Cheers
 
G

Gossipsfrolick

Very many thanks - it works! I would never have worked that out, although I
did try organising it so that I mentioned Child 2 before child1 but without
success. I'm still trying analyse exactly what you have done in case I need
to repeat it.

Grateful thanks - you've saved me a great deal of embarrassment.

Gillian
 
A

alan-hurley

The only problem with the solution below is that it uses
nested "IF" statements. Those work in a regular merge,
but when you merge to Outlook, they don't work properly.
At least, that has been my experience.

Alan

------------------------------------------------------
-----Original Message-----
Hi,

Try:

{IF{MERGEFIELD "Childs_first_names_2"}= "" {MERGEFIELD
"Childs_first_names_1"} {IF
{MERGEFIELD "Childs_first_names_3"}=""
"{MERGEFIELD "Childs_first_names_1"} and {MERGEFIELD
"Childs_first_names_2"}" "{MERGEFIELD "Childs_first_names_ 1"}, {MERGEFIELD
"Childs_first_names_2"} and
{MERGEFIELD "Childs_first_names_3"}"}}
 
M

macropod

In which case you could use two independent IF fields, like:
{IF{MERGEFIELD "Childs_first_names_3"}<> "" "{MERGEFIELD
"Childs_first_names_3"}, " ""}{IF{MERGEFIELD "Childs_first_names_2"}<> ""
"{MERGEFIELD "Childs_first_names_2"} and " ""}{MERGEFIELD
"Childs_first_names_1"}

Note that this reverses the name order, but the original poster's reply
indicated that wouldn't have been a problem either.

Cheers


message The only problem with the solution below is that it uses
nested "IF" statements. Those work in a regular merge,
but when you merge to Outlook, they don't work properly.
At least, that has been my experience.

Alan

------------------------------------------------------
-----Original Message-----
Hi,

Try:

{IF{MERGEFIELD "Childs_first_names_2"}= "" {MERGEFIELD
"Childs_first_names_1"} {IF
{MERGEFIELD "Childs_first_names_3"}=""
"{MERGEFIELD "Childs_first_names_1"} and {MERGEFIELD
"Childs_first_names_2"}" "{MERGEFIELD "Childs_first_names_ 1"}, {MERGEFIELD
"Childs_first_names_2"} and
{MERGEFIELD "Childs_first_names_3"}"}}
 

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