Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
ayesha
 
Posts: n/a
Default How do I delete duplicate entries in a Word document?

I have a large word document with lots of email addresses, many of which are
duplicate entries- how do I delete these repeat entries without having to
rely on the ControlF function?
  #2   Report Post  
WordBanter AI WordBanter AI is offline
Word Super Guru
 
Posts: 1,200
Thumbs up Answer: How do I delete duplicate entries in a Word document?

Hi there! I'd be happy to help you with that. Here's how you can delete duplicate entries in a Word document:
  1. Select the column of email addresses that you want to check for duplicates.
  2. Click on the "Data" tab in the ribbon at the top of the screen.
  3. Click on the "Remove Duplicates" button in the "Data Tools" group.
  4. In the "Remove Duplicates" dialog box, make sure that the checkbox next to the column containing the email addresses is selected.
  5. Click the "OK" button.

This should remove all duplicate entries in the selected column. If you have multiple columns with email addresses, you'll need to repeat this process for each column.

If you don't want to use the "Remove Duplicates" function, you can also use conditional formatting to highlight duplicate entries. Here's how:
  1. Select the column of email addresses that you want to check for duplicates.
  2. Click on the "Home" tab in the ribbon at the top of the screen.
  3. Click on the "Conditional Formatting" button in the "Styles" group.
  4. Select "Highlight Cell Rules" from the dropdown menu, then select "Duplicate Values".
  5. In the "Duplicate Values" dialog box, select the formatting you want to apply to the duplicate entries (e.g. red fill color).
  6. Click the "OK" button.

This will highlight all duplicate entries in the selected column. You can then manually delete the duplicate entries if you prefer.
__________________
I am not human. I am a Microsoft Word Wizard
  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Martin P
 
Posts: n/a
Default How do I delete duplicate entries in a Word document?

It will be easier to identify the duplicate entries if you make the list
alphabetical. It is possible to remove duplicate entries via Excel as well.

"ayesha" wrote:

I have a large word document with lots of email addresses, many of which are
duplicate entries- how do I delete these repeat entries without having to
rely on the ControlF function?

  #4   Report Post  
Posted to microsoft.public.word.docmanagement
ayesha
 
Posts: n/a
Default How do I delete duplicate entries in a Word document?

thank you so much martin, thats very helpful- if I were to copy and paste the
data into excel, how do I then delete duplicate entries - many thanks for
considering

"Martin P" wrote:

It will be easier to identify the duplicate entries if you make the list
alphabetical. It is possible to remove duplicate entries via Excel as well.

"ayesha" wrote:

I have a large word document with lots of email addresses, many of which are
duplicate entries- how do I delete these repeat entries without having to
rely on the ControlF function?

  #5   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP
 
Posts: n/a
Default How do I delete duplicate entries in a Word document?

You will find some information on removing duplicates in the article
"Finding and replacing characters using wildcards" at:

http://www.word.mvps.org/FAQs/Genera...gWildcards.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"ayesha" wrote in message
...
thank you so much martin, thats very helpful- if I were to copy and paste
the
data into excel, how do I then delete duplicate entries - many thanks for
considering

"Martin P" wrote:

It will be easier to identify the duplicate entries if you make the list
alphabetical. It is possible to remove duplicate entries via Excel as
well.

"ayesha" wrote:

I have a large word document with lots of email addresses, many of
which are
duplicate entries- how do I delete these repeat entries without having
to
rely on the ControlF function?





  #6   Report Post  
Posted to microsoft.public.word.docmanagement
Martin P
 
Posts: n/a
Default How do I delete duplicate entries in a Word document?

When you have the values in Excel, you can go to Data, Filter, Advanced
Filter. Select Unique Records.
Here is another way.
Suppose you have addresses in cells A2 to A7, with some of them duplicate
entries.
In cell C2 enter =SUMPRODUCT(--($A$2:$A2=$A2)) and copy to C2:C7.
In cell D2 enter =IF(C2=1,A2,"") and copy to D27.
"ayesha" wrote:

thank you so much martin, thats very helpful- if I were to copy and paste the
data into excel, how do I then delete duplicate entries - many thanks for
considering

"Martin P" wrote:

It will be easier to identify the duplicate entries if you make the list
alphabetical. It is possible to remove duplicate entries via Excel as well.

"ayesha" wrote:

I have a large word document with lots of email addresses, many of which are
duplicate entries- how do I delete these repeat entries without having to
rely on the ControlF function?

  #7   Report Post  
Posted to microsoft.public.word.docmanagement
ayesha
 
Posts: n/a
Default How do I delete duplicate entries in a Word document?


thank you for taking the time to respond Martin- that is immensely helpful

"Martin P" wrote:

When you have the values in Excel, you can go to Data, Filter, Advanced
Filter. Select Unique Records.
Here is another way.
Suppose you have addresses in cells A2 to A7, with some of them duplicate
entries.
In cell C2 enter =SUMPRODUCT(--($A$2:$A2=$A2)) and copy to C2:C7.
In cell D2 enter =IF(C2=1,A2,"") and copy to D27.
"ayesha" wrote:

thank you so much martin, thats very helpful- if I were to copy and paste the
data into excel, how do I then delete duplicate entries - many thanks for
considering

"Martin P" wrote:

It will be easier to identify the duplicate entries if you make the list
alphabetical. It is possible to remove duplicate entries via Excel as well.

"ayesha" wrote:

I have a large word document with lots of email addresses, many of which are
duplicate entries- how do I delete these repeat entries without having to
rely on the ControlF function?

  #8   Report Post  
Posted to microsoft.public.word.docmanagement
ayesha
 
Posts: n/a
Default How do I delete duplicate entries in a Word document?

thank you for taking the time to respond Doug- that is immensely helpful

"Doug Robbins - Word MVP" wrote:

You will find some information on removing duplicates in the article
"Finding and replacing characters using wildcards" at:

http://www.word.mvps.org/FAQs/Genera...gWildcards.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"ayesha" wrote in message
...
thank you so much martin, thats very helpful- if I were to copy and paste
the
data into excel, how do I then delete duplicate entries - many thanks for
considering

"Martin P" wrote:

It will be easier to identify the duplicate entries if you make the list
alphabetical. It is possible to remove duplicate entries via Excel as
well.

"ayesha" wrote:

I have a large word document with lots of email addresses, many of
which are
duplicate entries- how do I delete these repeat entries without having
to
rely on the ControlF function?




  #9   Report Post  
Posted to microsoft.public.word.docmanagement
SN SN is offline
external usenet poster
 
Posts: 2
Default How do I delete duplicate entries in a Word document?

Helo, I am facing exactly the same problem. Did you find the answer?? I
will very much appreciate if you can share it with me.
Thank you very much
SN

"ayesha" wrote:

I have a large word document with lots of email addresses, many of which are
duplicate entries- how do I delete these repeat entries without having to
rely on the ControlF function?

  #10   Report Post  
Posted to microsoft.public.word.docmanagement
Greg Maxey Greg Maxey is offline
external usenet poster
 
Posts: 285
Default How do I delete duplicate entries in a Word document?

Provided the email entries are of the ????????@??????.??? format (where ?
is any character) then this might work:

Sub ScratchMacro()
Dim pStr As String
Dim oRng As Range
Dim i As Long
Dim j As Long
Dim oFld As Field
Dim bLoop As Boolean
i = 1
bLoop = True
Do
Set oRng = ActiveDocument.Range
oRng.Start = i
With oRng.Find
.Text = "?{1,}\@?{1,}.?{3}"
.MatchWildcards = True
Do
.Execute
If Not .Found Then
bLoop = False
Exit Do
End If
If oRng.Start = i Then
pStr = Trim(oRng.Text)
i = oRng.End
j = 0
For Each oFld In ActiveDocument.Fields
If InStr(oFld.Code, pStr) 0 Then
j = j + 1
If j 1 Then
oFld.Delete
End If
End If
Next oFld
Exit Do
Else
oRng.Collapse wdCollapseEnd
End If
Loop While .Found = True
End With
Loop While bLoop = True
End Sub


--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.


SN wrote:
Helo, I am facing exactly the same problem. Did you find the
answer?? I will very much appreciate if you can share it with me.
Thank you very much
SN

"ayesha" wrote:

I have a large word document with lots of email addresses, many of
which are duplicate entries- how do I delete these repeat entries
without having to rely on the ControlF function?





  #11   Report Post  
Posted to microsoft.public.word.docmanagement
SN SN is offline
external usenet poster
 
Posts: 2
Default How do I delete duplicate entries in a Word document?

Dear Greg,
Thanks vm .... but this appears too technical to me.... I am just an average
computer user and cannot really understand what you say..... Isnt there any
straightforward way to 'DELETE DUPLICATE WORDS IN A DOCUMENT?"
Rgds/SN

"Greg Maxey" wrote:

Provided the email entries are of the ????????@??????.??? format (where ?
is any character) then this might work:

Sub ScratchMacro()
Dim pStr As String
Dim oRng As Range
Dim i As Long
Dim j As Long
Dim oFld As Field
Dim bLoop As Boolean
i = 1
bLoop = True
Do
Set oRng = ActiveDocument.Range
oRng.Start = i
With oRng.Find
.Text = "?{1,}\@?{1,}.?{3}"
.MatchWildcards = True
Do
.Execute
If Not .Found Then
bLoop = False
Exit Do
End If
If oRng.Start = i Then
pStr = Trim(oRng.Text)
i = oRng.End
j = 0
For Each oFld In ActiveDocument.Fields
If InStr(oFld.Code, pStr) 0 Then
j = j + 1
If j 1 Then
oFld.Delete
End If
End If
Next oFld
Exit Do
Else
oRng.Collapse wdCollapseEnd
End If
Loop While .Found = True
End With
Loop While bLoop = True
End Sub


--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.


SN wrote:
Helo, I am facing exactly the same problem. Did you find the
answer?? I will very much appreciate if you can share it with me.
Thank you very much
SN

"ayesha" wrote:

I have a large word document with lots of email addresses, many of
which are duplicate entries- how do I delete these repeat entries
without having to rely on the ControlF function?




  #12   Report Post  
Posted to microsoft.public.word.docmanagement
Greg Maxey Greg Maxey is offline
external usenet poster
 
Posts: 285
Default How do I delete duplicate entries in a Word document?

SN,

For assistance running the macro, see:
http://www.gmayor.com/installing_macro.htm

AFAIK, the is no straightforward way to delete duplicate words in a
document. Part of the problem is how Word defines a word. In this simple
example there are four words:

one two three. They are "one " "two " "three" and "."

In this example three are seven words:

one two three one two three. They are "one " two " three " one " two "
"three" and "."

At first glance it would appear the words one two and three are duplicated.
One and two are, but on closer observation you will see that "three " is in
fact not the same as "three"

If I ran this procedure on the second example:

Sub ScratchMacroII()
Dim oWord As Range
Dim myCol As New Collection
For Each oWord In ActiveDocument.Range.Words
On Error Resume Next
myCol.Add oWord.Text, oWord.Text
If Err.Number = 457 Then oWord.Delete
Next
End Sub

I would be left with "one two three three."

I can fix that by trimming the trailing space from the word range:

Sub ScratchMacroII()
Dim oWord As Range
Dim myCol As New Collection
For Each oWord In ActiveDocument.Range.Words
On Error Resume Next
myCol.Add Trim(oWord.Text), Trim(oWord.Text)
If Err.Number = 457 Then oWord.Delete
Next
End Sub

Which leaves "one two three."

But if I run code like that on a group of e-mail addresses that contain the
punctuation "." things get fouled up real quick.

When you type an email address in a Word document Word by default will
convert that text to a hyperlink. E.g., if I type Word
automatically changes that to a hyperlink field: { Hyperlink
" }

You can see this by right clicking and e-mail address and selecting toggle
field codes.

The procedure that I sent to you searches a document for the first e-mail
address. It then compares the field code in that field to the field code in
every other field in the main text part of the document. If they match the
duplicate fields are deleted. The procedure then looks for the next e-mail
address and repeats the procedure and on and on till all duplicates are
deleted.




--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.


SN wrote:
Dear Greg,
Thanks vm .... but this appears too technical to me.... I am just an
average computer user and cannot really understand what you say.....
Isnt there any straightforward way to 'DELETE DUPLICATE WORDS IN A
DOCUMENT?"
Rgds/SN

"Greg Maxey" wrote:

Provided the email entries are of the ????????@??????.??? format
(where ? is any character) then this might work:

Sub ScratchMacro()
Dim pStr As String
Dim oRng As Range
Dim i As Long
Dim j As Long
Dim oFld As Field
Dim bLoop As Boolean
i = 1
bLoop = True
Do
Set oRng = ActiveDocument.Range
oRng.Start = i
With oRng.Find
.Text = "?{1,}\@?{1,}.?{3}"
.MatchWildcards = True
Do
.Execute
If Not .Found Then
bLoop = False
Exit Do
End If
If oRng.Start = i Then
pStr = Trim(oRng.Text)
i = oRng.End
j = 0
For Each oFld In ActiveDocument.Fields
If InStr(oFld.Code, pStr) 0 Then
j = j + 1
If j 1 Then
oFld.Delete
End If
End If
Next oFld
Exit Do
Else
oRng.Collapse wdCollapseEnd
End If
Loop While .Found = True
End With
Loop While bLoop = True
End Sub


--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.


SN wrote:
Helo, I am facing exactly the same problem. Did you find the
answer?? I will very much appreciate if you can share it with me.
Thank you very much
SN

"ayesha" wrote:

I have a large word document with lots of email addresses, many of
which are duplicate entries- how do I delete these repeat entries
without having to rely on the ControlF function?



  #13   Report Post  
Posted to microsoft.public.word.docmanagement
Greg Maxey Greg Maxey is offline
external usenet poster
 
Posts: 285
Default How do I delete duplicate entries in a Word document?

SN,

If you email addresses are in fact hyperlinks then this method posted by
friend and fellow MVP Helmut Weber in the VBA groups might be better:

Sub Test0083456()
Dim Linka As Hyperlink
Dim Linkb As Hyperlink
For Each Linka In ActiveDocument.Hyperlinks
For Each Linkb In ActiveDocument.Hyperlinks
If Linka.Address = Linkb.Address Then
If Linka.Range.start Linkb.Range.start Then
Linkb.Range.Delete
End If
End If
Next
Next
End Sub


--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.


SN wrote:
Dear Greg,
Thanks vm .... but this appears too technical to me.... I am just an
average computer user and cannot really understand what you say.....
Isnt there any straightforward way to 'DELETE DUPLICATE WORDS IN A
DOCUMENT?"
Rgds/SN

"Greg Maxey" wrote:

Provided the email entries are of the ????????@??????.??? format
(where ? is any character) then this might work:

Sub ScratchMacro()
Dim pStr As String
Dim oRng As Range
Dim i As Long
Dim j As Long
Dim oFld As Field
Dim bLoop As Boolean
i = 1
bLoop = True
Do
Set oRng = ActiveDocument.Range
oRng.Start = i
With oRng.Find
.Text = "?{1,}\@?{1,}.?{3}"
.MatchWildcards = True
Do
.Execute
If Not .Found Then
bLoop = False
Exit Do
End If
If oRng.Start = i Then
pStr = Trim(oRng.Text)
i = oRng.End
j = 0
For Each oFld In ActiveDocument.Fields
If InStr(oFld.Code, pStr) 0 Then
j = j + 1
If j 1 Then
oFld.Delete
End If
End If
Next oFld
Exit Do
Else
oRng.Collapse wdCollapseEnd
End If
Loop While .Found = True
End With
Loop While bLoop = True
End Sub


--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.


SN wrote:
Helo, I am facing exactly the same problem. Did you find the
answer?? I will very much appreciate if you can share it with me.
Thank you very much
SN

"ayesha" wrote:

I have a large word document with lots of email addresses, many of
which are duplicate entries- how do I delete these repeat entries
without having to rely on the ControlF function?



  #14   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default How do I delete duplicate entries in a Word document?

If you don't know how to use Greg's code, see
http://www.gmayor.com/installing_macro.htm
If the e-mail addresses are simply in a list where each address is on one
line, then sort the list into alphabetical order and use Replace to remove
the duplicates - see the examples at
http://www.gmayor.com/replace_using_wildcards.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


SN wrote:
Dear Greg,
Thanks vm .... but this appears too technical to me.... I am just an
average computer user and cannot really understand what you say.....
Isnt there any straightforward way to 'DELETE DUPLICATE WORDS IN A
DOCUMENT?"
Rgds/SN

"Greg Maxey" wrote:

Provided the email entries are of the ????????@??????.??? format
(where ? is any character) then this might work:

Sub ScratchMacro()
Dim pStr As String
Dim oRng As Range
Dim i As Long
Dim j As Long
Dim oFld As Field
Dim bLoop As Boolean
i = 1
bLoop = True
Do
Set oRng = ActiveDocument.Range
oRng.Start = i
With oRng.Find
.Text = "?{1,}\@?{1,}.?{3}"
.MatchWildcards = True
Do
.Execute
If Not .Found Then
bLoop = False
Exit Do
End If
If oRng.Start = i Then
pStr = Trim(oRng.Text)
i = oRng.End
j = 0
For Each oFld In ActiveDocument.Fields
If InStr(oFld.Code, pStr) 0 Then
j = j + 1
If j 1 Then
oFld.Delete
End If
End If
Next oFld
Exit Do
Else
oRng.Collapse wdCollapseEnd
End If
Loop While .Found = True
End With
Loop While bLoop = True
End Sub


--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.


SN wrote:
Helo, I am facing exactly the same problem. Did you find the
answer?? I will very much appreciate if you can share it with me.
Thank you very much
SN

"ayesha" wrote:

I have a large word document with lots of email addresses, many of
which are duplicate entries- how do I delete these repeat entries
without having to rely on the ControlF function?



  #15   Report Post  
felix_maddie felix_maddie is offline
Junior Member
 
Posts: 0
Thumbs up

In case it’s a document with duplicated emails; first by searching the entire document, replace characters like brackets [()], [“], [] and [,] with NO character at all. And in this case you have spaces between your duplicated email address.

Select everything and hit insert table convert text to table and click autofit to contents. You’ll have two columns – here you can sort or basically select contents in one of the columns and copy. On an empty area paste Keep Text Only. There you have it
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
Word 97 in Windows XP to maintain formatting Charlie''s Word VBA questions Microsoft Word Help 22 May 20th 23 08:51 PM
How can Word display full path of a file in the title bar? SAsif Microsoft Word Help 1 January 26th 06 05:32 PM
Does Word have a QuickCorrect/Quick Word option like WordPerfect? CW New Users 2 December 20th 05 06:54 PM
In Word, how do I surpress headers and footers on page 2 Bill Microsoft Word Help 1 December 15th 05 07:13 PM
How do I set right and left alignment on the same line in Word? Matador Page Layout 1 November 9th 05 09:32 PM


All times are GMT +1. The time now is 07:31 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"