PC Review


Reply
Thread Tools Rate Thread

Check duplicates

 
 
=?Utf-8?B?ZGpFeGNlbA==?=
Guest
Posts: n/a
 
      10th Sep 2007
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 With Quote
 
 
 
 
Bernard Liengme
Guest
Posts: n/a
 
      10th Sep 2007
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" <(E-Mail Removed)> wrote in message
news:4CB19480-D002-4673-9D65-(E-Mail Removed)...
> 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 With Quote
 
=?Utf-8?B?TWlrZSBI?=
Guest
Posts: n/a
 
      10th Sep 2007
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Check for Duplicates then Sum cells of duplicates aileen Microsoft Excel Programming 7 11th Dec 2008 03:15 PM
check for duplicates =?Utf-8?B?VG9kZA==?= Microsoft Excel Worksheet Functions 0 7th Nov 2006 05:59 PM
Check for Duplicates nebb Microsoft Excel Worksheet Functions 2 13th Feb 2006 02:39 PM
Check Duplicates w/o duplicates! Mark Microsoft Access 0 10th Feb 2005 03:39 PM
Check for duplicates Jeff Microsoft Access Form Coding 2 6th Oct 2004 04:27 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:52 PM.