Solved

Duplicate rows in excel

Posted on 2011-02-15
2
344 Views
Last Modified: 2012-05-11
Please look at the attached duplicatesexamplea.xls.

I need to identify any duplicates in Sheet1 column B.  My result should look like Sheet2.

How can I do this?

duplicatesexamplea.xls
0
Comment
Question by:EEuser5551212
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 24

Accepted Solution

by:
StephenJR earned 250 total points
ID: 34897565
A macro solution:
Sub x()

Dim r1 As Range, r2 As Range

With Sheets("Sheet1")
    Set r1 = .Range("B1", .Range("B1").End(xlDown))
    For Each r2 In r1
        If WorksheetFunction.CountIf(r1, r2) > 1 Then
            Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp)(2).Resize(, 2).Value = r2.Offset(, -1).Resize(, 2).Value
        End If
    Next r2
End With

End Sub

Open in new window

0
 
LVL 7

Expert Comment

by:twol
ID: 34897617
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question