PC Review


Reply
Thread Tools Rate Thread

Deleting repeated rows

 
 
anjanesh
Guest
Posts: n/a
 
      30th May 2006

I got an excel file which has around 50k rows but should have around 25k
rows - some have got duplicated somehow - the first column that I have
is the ID which is unique - is there any way to delete rows having
repeated IDs ?

Thanks


--
anjanesh

Freelance Developer
------------------------------------------------------------------------
anjanesh's Profile: http://www.excelforum.com/member.php...o&userid=27132
View this thread: http://www.excelforum.com/showthread...hreadid=546593

 
Reply With Quote
 
 
 
 
Bondi
Guest
Posts: n/a
 
      30th May 2006
Hi,

You could put a button in the sheet and use this code:

Private Sub CommandButton1_Click()
Dim x As Long
Dim LastRow As Long

LastRow = Range("A65536").End(xlUp).Row
For x = LastRow To 1 Step -1
If Application.WorksheetFunction.CountIf(Range("A1:A" & x),
Range("A" & x).Text) > 1 Then
Range("A" & x).EntireRow.Delete
End If
Next x

End Sub


Regards,
Bondi

 
Reply With Quote
 
aresen
Guest
Posts: n/a
 
      30th May 2006
This sounds like a one-time effort. Try this.
Select cell A1 and Insert... Columns
Now your unique IDs are in column B.
Type any character in cell A1 (will explain later)
Now select column A (the whole column should be highlighted)
Now Edit... Go To... Special... Blanks Then hit OK
The blank cells will be selected and the active one should be B2.
Type the formula =MATCH(B2,B$1:B1,0) and, while holding <ctrl>, hit
enter.
Again, Edit... Go To... Special... Formulas
Below Formulas, you have four option buttons. De-select Errors.
(Actually, the only one you need selected is Numbers) Then hit OK.
Edit... Delete... Entire Row then OK.
Last of all, you can delete column A.

What you are doing is trying to match each ID with those above it. If
it has no match, you get an error (#N/A) which means that, so far, it's
unique. Those that yield a number are conversely not unique and subject
to deletion. The special go to selected only the non-error which were
the numbers which you then deleted.
One other point. The original go to looking for blanks only selects
blanks down to the last row ever used on your worksheet.

 
Reply With Quote
 
Lars
Guest
Posts: n/a
 
      3rd Jun 2006
On 30 May 2006 15:03:15 -0700, "aresen" <(E-Mail Removed)> wrote:

>Select cell A1 and Insert... Columns
>Now your unique IDs are in column B.
>Type any character in cell A1 (will explain later)
>Now select column A (the whole column should be highlighted)
>Now Edit... Go To... Special... Blanks Then hit OK
>The blank cells will be selected and the active one should be B2.
>Type the formula =MATCH(B2,B$1:B1,0) and, while holding <ctrl>, hit
>enter.


I tried that and Excel comes back with a message that the formula
contains an error.


Lars
Stockholm
 
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
deleting repeated rows dummy Microsoft Excel Worksheet Functions 7 31st Jan 2010 12:36 AM
repeated rows to single rows with many columns geanswerman Microsoft Excel Misc 2 11th Jun 2009 06:51 PM
deleting repeated text from a drop down box LTaylor Microsoft Excel Misc 0 28th Mar 2008 03:04 PM
Deleting Repeated Rows =?Utf-8?B?Q29uc3RhbnRseSBBbWF6ZWQ=?= Microsoft Excel Worksheet Functions 2 9th Nov 2006 10:45 AM
Deleting cells with repeated data petevang Microsoft Excel Worksheet Functions 2 6th Dec 2005 10:27 PM


Features
 

Advertising
 

Newsgroups
 


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