Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Rod Rod is offline
external usenet poster
 
Posts: 14
Default Macro for Finding Duplicate Data Entries

Word 2007

Hello Gurus:

I have two listings of e-mail addresses. List A has approximately 33,000
entries and List B has approximately 2,000 entries.

If possible, I would like to select each individual email entry in List A
and compare it to the entries in List B in search of a duplicate entry. If
the e-mail entry from List A is found in list B, I would like to delete the
email entry from List B.

If the e-mail entry is NOT found in List B, I would like to proceed to the
subsequent e-mail entry in List A and begin the process all over again.

Any assistance in this regard would be very much appreciated.

Thanking you in advance, I remain€¦

Very truly yours €“ Rod


  #2   Report Post  
Posted to microsoft.public.word.docmanagement
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Macro for Finding Duplicate Data Entries

Hi Rod,

This is quite easy to do in Excel, without the need for a macro -simply put both lists into a single column (eg Column A) and insert
the following formula into column B:
=COUNTIF(A$1:A1,A1)
and copy down as far as needed. Then copy & paste column B as values and sort the data by column B. All the duplicates will then be
grouped together and the data will be otherwise in the same order as you originally had it.


--
Cheers
macropod
[Microsoft MVP - Word]


"Rod" wrote in message ...
Word 2007

Hello Gurus:

I have two listings of e-mail addresses. List A has approximately 33,000
entries and List B has approximately 2,000 entries.

If possible, I would like to select each individual email entry in List A
and compare it to the entries in List B in search of a duplicate entry. If
the e-mail entry from List A is found in list B, I would like to delete the
email entry from List B.

If the e-mail entry is NOT found in List B, I would like to proceed to the
subsequent e-mail entry in List A and begin the process all over again.

Any assistance in this regard would be very much appreciated.

Thanking you in advance, I remain€¦

Very truly yours €“ Rod



  #3   Report Post  
Posted to microsoft.public.word.docmanagement
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Macro for Finding Duplicate Data Entries

Hi Rod,

This is quite easy to do in Excel, without the need for a macro -simply put both lists into a single column (eg Column A) and insert
the following formula into column B:
=COUNTIF(A$1:A1,A1)
and copy down as far as needed. Then copy & paste column B as values and sort the data by column B. All the duplicates will then be
grouped together and the data will be otherwise in the same order as you originally had it.


--
Cheers
macropod
[Microsoft MVP - Word]


"Rod" wrote in message ...
Word 2007

Hello Gurus:

I have two listings of e-mail addresses. List A has approximately 33,000
entries and List B has approximately 2,000 entries.

If possible, I would like to select each individual email entry in List A
and compare it to the entries in List B in search of a duplicate entry. If
the e-mail entry from List A is found in list B, I would like to delete the
email entry from List B.

If the e-mail entry is NOT found in List B, I would like to proceed to the
subsequent e-mail entry in List A and begin the process all over again.

Any assistance in this regard would be very much appreciated.

Thanking you in advance, I remain€¦

Very truly yours €“ Rod



  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Macro for Finding Duplicate Data Entries

Assuming that the lists in question are simple lists with one entry per
paragraph in each document, then the following macro will remove from the
short list any item that appears in the long list. Run it on *copies* of the
document lists. Change the document paths as required.

Dim LongList As Document
Dim ShortList As Document
Set LongList = Documents.Open("D:\My Documents\Test\Temp\List1.docx")
Set ShortList = Documents.Open("D:\My Documents\Test\Temp\List2.docx")
For i = ShortList.Paragraphs.Count To 1 Step -1
With LongList.Range.Find
.Text = ShortList.Paragraphs(i).Range.Text
Do While .Execute(Forward:=True) = True
ShortList.Paragraphs(i).Range.Delete
Loop
End With
Next i

It could take a while to run
http://www.gmayor.com/installing_macro.htm


"Rod" wrote in message
...
Word 2007

Hello Gurus:

I have two listings of e-mail addresses. List A has approximately 33,000
entries and List B has approximately 2,000 entries.

If possible, I would like to select each individual email entry in List A
and compare it to the entries in List B in search of a duplicate entry.
If
the e-mail entry from List A is found in list B, I would like to delete
the
email entry from List B.

If the e-mail entry is NOT found in List B, I would like to proceed to the
subsequent e-mail entry in List A and begin the process all over again.

Any assistance in this regard would be very much appreciated.

Thanking you in advance, I remain.

Very truly yours - Rod




  #5   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Macro for Finding Duplicate Data Entries

Assuming that the lists in question are simple lists with one entry per
paragraph in each document, then the following macro will remove from the
short list any item that appears in the long list. Run it on *copies* of the
document lists. Change the document paths as required.

Dim LongList As Document
Dim ShortList As Document
Set LongList = Documents.Open("D:\My Documents\Test\Temp\List1.docx")
Set ShortList = Documents.Open("D:\My Documents\Test\Temp\List2.docx")
For i = ShortList.Paragraphs.Count To 1 Step -1
With LongList.Range.Find
.Text = ShortList.Paragraphs(i).Range.Text
Do While .Execute(Forward:=True) = True
ShortList.Paragraphs(i).Range.Delete
Loop
End With
Next i

It could take a while to run
http://www.gmayor.com/installing_macro.htm


"Rod" wrote in message
...
Word 2007

Hello Gurus:

I have two listings of e-mail addresses. List A has approximately 33,000
entries and List B has approximately 2,000 entries.

If possible, I would like to select each individual email entry in List A
and compare it to the entries in List B in search of a duplicate entry.
If
the e-mail entry from List A is found in list B, I would like to delete
the
email entry from List B.

If the e-mail entry is NOT found in List B, I would like to proceed to the
subsequent e-mail entry in List A and begin the process all over again.

Any assistance in this regard would be very much appreciated.

Thanking you in advance, I remain.

Very truly yours - Rod




Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding duplicate phrases and paragraphs. Frank Martin New Users 4 May 13th 23 08:49 AM
Finding Autotext Entries rvwalker212 Microsoft Word Help 1 December 18th 08 08:13 AM
Multiple TOC - duplicate entries margot_eon Microsoft Word Help 1 August 5th 07 09:25 PM
Finding duplicate entries Uzmi Novce I Bjezi! New Users 3 March 4th 06 01:19 PM
Finding and Removing Duplicate Entries Willie Everlearn Microsoft Word Help 2 February 10th 06 01:59 PM


All times are GMT +1. The time now is 12:51 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"