Solved

Duplicate rows in excel

Posted on 2011-02-15
2
340 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
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
A short article about problems I had with the new location API and permissions in Marshmallow
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now