Formatting Mergefiled Problems

M

malycom

Hi

I have looked up and found lots of similar problems with this but I haven't
found a specific answer.

By the way, this is the first time this problem has happened to me and I
have done dozens of merges so I don't know what's happened.

Firstly, my merged data from Excel is inserting a 0 where a filed is blank.

Example
Mr Name-1 Name-2
43 Some Street
City
0
0
0 postcode

Should look like

Mr Name-1 Name-2
43 Some Street
City
Postcode

I have tried things such as {IF{MERGEFIELD 'Excel data'} <> 0 "{MERGEFIELD
'Excel data'}"} but this merely took out the zero leaving blank lines kind of
like this

Mr Name-1 Name-2
43 Some Street
City


postcode

I then found this function {MERGEFIELD ExcelData \# 0;;} which removed the
blank lines but this has thrown up another error.
Anywhere there is more than one word in a mergefield, only the first word is
displayed and anything including and after the first space is missing.
Again, kind of like this.

Oh, and the Mr, Name-1 & Name-2 are 3 seperate Mergefields so they are ok.

Mr Name-1 Name-2
43
City
NW1

So, the 'Some Street' of '43 Some Street' is missing from address_1 and the
second part of the post code is missing after the space.

I hope I haven't made this to confusing.

Any healp is greatly appreciated.

Oh, Merry Christmas everyone.
 
G

Graham Mayor

You are only adopting half a solution. You should conditionally insert the
field AND the line break eg
{Mergefield Field1}{IF {Mergefield Field2} <> "0" "
{Mergefield Field2}{IF {Mergefield Field3} <> "0" "
{Mergefield Field3}etc

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
M

malycom

Hi Graham

Thanks for the help but I am not sure I am getting it.

Showing what I have entered which I thought is what you were suggesting, but
the 0's are now showing again.

I'd really appreciate it if you could help with this.

Thanks in advance

Malcolm

{Mergefield "EN_PRETITLE"} {Mergefield "EN_FIRST"} {Mergefield "EN_LAST"}
{Mergefield "ADD_1"}{IF {Mergefield "ADD_2"} <> "0" "}
{Mergefield "ADD_2"}{IF {Mergefield "ADD_3"} <> "0" "}
{Mergefield "ADD_3"}{IF {Mergefield "ADD_4"} <> "0" "}
{Mergefield "ADD_4"}{IF {Mergefield "ADD_5"} <> "0" "}
{Mergefield "ADD_5"}{IF {Mergefield "ADD_6"} <> "0" "}
{Mergefield "ADD_6"}{IF {Mergefield "EN_COUNTRY"} <> "0" "}
{Mergefiled "EN_COUNTRY"} {MERGEFIELD "EN_POSTCODE"}

THis is how the first results are coming out.......


0 0 0
2 Cross Park Road
Batley
West Yorkshire
0
0
0
UK WF17 5NY

And

Mr ***** ***** (Name came out correctly)
Selham House
Nr Petworth
West Sussex
0
0
0
UK GU28 0PS
 
G

Graham Mayor

Check the positions of your field brackets and you may not need the quotes
around 0 so

{Mergefield "EN_PRETITLE"} {Mergefield "EN_FIRST"} {Mergefield "EN_LAST"}¶
{Mergefield "ADD_1"}{IF {Mergefield "ADD_2"} <> "0" "¶
{Mergefield "ADD_2"}"}{IF {Mergefield "ADD_3"} <> "0" "¶
{Mergefield "ADD_3"}"}{IF {Mergefield "ADD_4"} <> "0" "¶
{Mergefield "ADD_4"}"}{IF {Mergefield "ADD_5"} <> "0" "¶
{Mergefield "ADD_5"}"}{IF {Mergefield "ADD_6"} <> "0" "¶
{Mergefield "ADD_6"}"}{IF {Mergefield "EN_COUNTRY"} <> "0" "¶
{Mergefield "EN_COUNTRY"} {MERGEFIELD "EN_POSTCODE"}"¶
{IF{MERGEFIELD "EN_POSTCODE "} <> "0" "{MERGEFIELD "EN_POSTCODE "}"}

Press enter only where you see ¶ and note the changes to the last two lines.

or without the quotes

{Mergefield "EN_PRETITLE"} {Mergefield "EN_FIRST"} {Mergefield "EN_LAST"}
{Mergefield "ADD_1"}{IF {Mergefield "ADD_2"} <> 0 "
{Mergefield "ADD_2"}"}{IF {Mergefield "ADD_3"} <> 0 "
{Mergefield "ADD_3"}"}{IF {Mergefield "ADD_4"} <> 0 "
{Mergefield "ADD_4"}"}{IF {Mergefield "ADD_5"} <> 0 "
{Mergefield "ADD_5"}"}{IF {Mergefield "ADD_6"} <> 0 "
{Mergefield "ADD_6"}"}{IF {Mergefield "EN_COUNTRY"} <> 0 "
{Mergefield "EN_COUNTRY"} {MERGEFIELD "EN_POSTCODE"}"
{IF{MERGEFIELD "EN_POSTCODE "} <> 0 "{MERGEFIELD "EN_POSTCODE "}"}

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
M

malycom

Hi Graham

Many thanks for your help - It's not 100% but it's possible I can use what
is there and do some manual editing to the individual letters after.

I really appreciate your help.

Regards
 

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