Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Cindy Lou
 
Posts: n/a
Default Is there a macro to identify and remove duplicate data in Excel?

I need to remove duplicate rows in a spreadsheet. These spreadsheets are
created several times each day and I currently have to remove the duplicate
rows manually. This can take a considerable amount of time. Is there a
macro or function that can identify and remove these duplicate rows?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Otto Moehrbach
 
Posts: n/a
Default Is there a macro to identify and remove duplicate data in Excel?

Cindy
I assume that by "duplicate rows" you mean that the value (entry) in one
column is duplicated in another cell in the same column, instead of the
entire row must be a duplicate. If this is correct, then the following
macro will do what you want.
I assumed, in writing this macro, that Column A is the column to look at.
Watch out for line wrap in this message, as that would effect the macro.
Expand this message to see the macro as it should be.
Make a copy of your file and try this out on the copy first. Post back if
this macro doesn't do what you want. HTH Otto
Sub RemoveDups()
Dim RngA As Range
Dim c As Long
Set RngA = Range("A1", Range("A" & Rows.Count).End(xlUp))
For c = RngA.Count To 1 Step -1
If RngA.Find(What:=Cells(c, 1).Value, After:=Cells(c, 1),
LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByColumns,
SearchDirection:=xlNext).Row c Then
Cells(c, 1).EntireRow.Delete
End If
Next c
End Sub
"Cindy Lou" <Cindy wrote in message
...
I need to remove duplicate rows in a spreadsheet. These spreadsheets are
created several times each day and I currently have to remove the
duplicate
rows manually. This can take a considerable amount of time. Is there a
macro or function that can identify and remove these duplicate rows?



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Lost in Alabama
 
Posts: n/a
Default Is there a macro to identify and remove duplicate data in Exce

Hello Otto,

I have a situation similar to this one, except the duplicates I want to
delete are by the Row (not by just one Cell). In other words, I need the
macro to look at the entire row for a duplicate. Also, the duplicate rows
may not be together and I cannot sort the data without loosing the original
order.

Is it possible to alter this macro to perform this function, or do you have
another suggestion?

Thanks,

Lost in Alabama

"Otto Moehrbach" wrote:

Cindy
I assume that by "duplicate rows" you mean that the value (entry) in one
column is duplicated in another cell in the same column, instead of the
entire row must be a duplicate. If this is correct, then the following
macro will do what you want.
I assumed, in writing this macro, that Column A is the column to look at.
Watch out for line wrap in this message, as that would effect the macro.
Expand this message to see the macro as it should be.
Make a copy of your file and try this out on the copy first. Post back if
this macro doesn't do what you want. HTH Otto
Sub RemoveDups()
Dim RngA As Range
Dim c As Long
Set RngA = Range("A1", Range("A" & Rows.Count).End(xlUp))
For c = RngA.Count To 1 Step -1
If RngA.Find(What:=Cells(c, 1).Value, After:=Cells(c, 1),
LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByColumns,
SearchDirection:=xlNext).Row c Then
Cells(c, 1).EntireRow.Delete
End If
Next c
End Sub
"Cindy Lou" <Cindy wrote in message
...
I need to remove duplicate rows in a spreadsheet. These spreadsheets are
created several times each day and I currently have to remove the
duplicate
rows manually. This can take a considerable amount of time. Is there a
macro or function that can identify and remove these duplicate rows?




  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Otto Moehrbach
 
Posts: n/a
Default Is there a macro to identify and remove duplicate data in Exce

Yes, the basic macro can be used for your case too. But it would have to be
modified to include a looping routine through all the cells in the row.
Send me an email with as much explanation as you can give. You might
include a small file that shows a sample of what you have. My email address
is . Remove the "nop" from this address. Otto
"Lost in Alabama" wrote in message
...
Hello Otto,

I have a situation similar to this one, except the duplicates I want to
delete are by the Row (not by just one Cell). In other words, I need the
macro to look at the entire row for a duplicate. Also, the duplicate rows
may not be together and I cannot sort the data without loosing the
original
order.

Is it possible to alter this macro to perform this function, or do you
have
another suggestion?

Thanks,

Lost in Alabama

"Otto Moehrbach" wrote:

Cindy
I assume that by "duplicate rows" you mean that the value (entry) in one
column is duplicated in another cell in the same column, instead of the
entire row must be a duplicate. If this is correct, then the following
macro will do what you want.
I assumed, in writing this macro, that Column A is the column to look at.
Watch out for line wrap in this message, as that would effect the macro.
Expand this message to see the macro as it should be.
Make a copy of your file and try this out on the copy first. Post back
if
this macro doesn't do what you want. HTH Otto
Sub RemoveDups()
Dim RngA As Range
Dim c As Long
Set RngA = Range("A1", Range("A" & Rows.Count).End(xlUp))
For c = RngA.Count To 1 Step -1
If RngA.Find(What:=Cells(c, 1).Value, After:=Cells(c, 1),
LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByColumns,
SearchDirection:=xlNext).Row c Then
Cells(c, 1).EntireRow.Delete
End If
Next c
End Sub
"Cindy Lou" <Cindy
wrote in message
...
I need to remove duplicate rows in a spreadsheet. These spreadsheets
are
created several times each day and I currently have to remove the
duplicate
rows manually. This can take a considerable amount of time. Is there
a
macro or function that can identify and remove these duplicate rows?






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
Macro to delete data in 'green' cells only Steve Excel Worksheet Functions 7 March 19th 05 01:40 PM


All times are GMT +1. The time now is 05:33 AM.

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"