Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Check duplicates

What is the fastest way to check and mark duplicates in a long list. I have a
sheet, which contains about 12.000 user names and I need to set a text
'duplicate' in column B (user name is in column A). If I use two Do..Loop, it
takes like ages. Any ideas?

Code I've been using:

X = 1 'first row
Do Until Cells(X + 1, 1) = ""
Y = X + 1
Do Until Cells(Y, 1) = ""
If Cells(Y, 1) = Cells(X, 1) Then
Cells(Y, 2) = "duplicate"
Cells(X, 2) = "duplicate"
End If
Y = Y + 1
Loop
X = X + 1
Loop

Note: Same user may appear several times in the list.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,393
Default Check duplicates

Have a look at
http://www.cpearson.com/excel/Duplicates.aspx
If you must, then most of Chips' idea could be implemented in VBA
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"djExcel" wrote in message
...
What is the fastest way to check and mark duplicates in a long list. I
have a
sheet, which contains about 12.000 user names and I need to set a text
'duplicate' in column B (user name is in column A). If I use two Do..Loop,
it
takes like ages. Any ideas?

Code I've been using:

X = 1 'first row
Do Until Cells(X + 1, 1) = ""
Y = X + 1
Do Until Cells(Y, 1) = ""
If Cells(Y, 1) = Cells(X, 1) Then
Cells(Y, 2) = "duplicate"
Cells(X, 2) = "duplicate"
End If
Y = Y + 1
Loop
X = X + 1
Loop

Note: Same user may appear several times in the list.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Check duplicates

Without a macro, put this in b1 and double click the fill handle to fill the
formula down:-

=IF(COUNTIF($A$1:$A$1000,A1)1,"Duplicate","")

Mike

"djExcel" wrote:

What is the fastest way to check and mark duplicates in a long list. I have a
sheet, which contains about 12.000 user names and I need to set a text
'duplicate' in column B (user name is in column A). If I use two Do..Loop, it
takes like ages. Any ideas?

Code I've been using:

X = 1 'first row
Do Until Cells(X + 1, 1) = ""
Y = X + 1
Do Until Cells(Y, 1) = ""
If Cells(Y, 1) = Cells(X, 1) Then
Cells(Y, 2) = "duplicate"
Cells(X, 2) = "duplicate"
End If
Y = Y + 1
Loop
X = X + 1
Loop

Note: Same user may appear several times in the list.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Check for duplicates? Vass[_2_] Excel Worksheet Functions 5 October 24th 07 11:12 PM
check for duplicates Todd Excel Worksheet Functions 0 November 7th 06 05:59 PM
Check for Duplicates Carter68 Excel Worksheet Functions 3 April 15th 06 12:13 AM
Check for Duplicates nebb Excel Worksheet Functions 2 February 13th 06 02:39 PM
Check for Duplicates (RP) Steph[_3_] Excel Programming 2 May 11th 05 08:18 PM


All times are GMT +1. The time now is 07:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"