Removing Duplicate data in consecutive fields

K

KallKwik Didcot

Just spotted an anomaly in an Excel database I'm merging.

I'm using MS word 2k and Excel 2k.

I have some entries where the data in 'Address 1' field is the same as the
data in the 'Address 2' field and I can't work out how to do a compare, and
ignore one of the lines in the event that they are the same.

Any help would be gratefully received.

Many thanks

Mark
 
D

Doug Robbins - Word MVP

Hi Mark,

Use and If... Then.... Else field to compare Address1 to Address2. Have it
insert just one of them if they are the same, or both if they are different.

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 
K

KallKwik Didcot

Hi Doug

Hmmm I tried that but I must be inputting it wrongly as it the 'IF-THEN'
either appears in the results as text or doesn't do anything. I'm also not
sure wether to put the 'IF-THEN' before, or after the 'Address 1 field'.
I've tried inputting it using the wizard but I'm not sure how to enter the
fields in the 'compare to' box or in the 'Otherwise print this' box. I've
also tried inputting directly after pressing Alt+F9.
Also when I find the solution, where the address line is ignored, would it
be treated like any other blank line so that the remaining part of the
address is shifted upwards (assuming the 'don't print blank lines' is
selected).

I daresay it is a simple solution, but it eludes me.

Cheers

Mark
 
D

Doug Robbins - Word MVP

Hi Mark,

Starting with the Wizard, select the Address1 mergefield as the one to be
tested and for the condition use Equal to and put a 1 in the box next to it.
Then for the results, enter 2 and then 3. Then click on OK.

Then press Alt+F9 to toggle on the field codes and you will see

{ IF { MERGEFIELD Address1 } = 1 "2" "3" }

Now, select the 1 and then insert the Address2 mergefield. Then select the
"2" and in place of it, insert the Address1 mergefield, and in place of the
"3", insert the Address1 mergefield plus Shift+Enter for a new line and then
the Address2 mergefield

so that you end up with

{ IF { MERGEFIELD Address1 } = { MERGEFIELD Address2 } { MERGEFIELD
Address1 } { MERGEFIELD Address1 }
{ MERGEFIELD Address2 } }

Toggle of the field codes with Alt+F9.

All this goes in place of the Address1 and Address2 mergefields. They
should not appear anywhere other than in the above field construction.

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 
K

KallKwik Didcot

Well that seems to have done the job Doug thank you.

I found this seemed to work better for me though (I deleted one of the
Address1 mergefields), but I will have to test the merge more to see if
there are any unwanted side effects.
{ IF { MERGEFIELD Address1 } = { MERGEFIELD Address2 } { MERGEFIELD
Address1 }
{ MERGEFIELD Address2 } }

Much appreciate your help

Many thanks

Mark
 
K

KallKwik Didcot

Hi Doug

You were right after all, I mistook the missing field as being the selective
deletion generated by the IF-THEN but on closer scrutiny, the field was
missing in all cases.

Again many thanks for that.

Cheers

Mark
 

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