How to remove entire rows with one specific matching cell.

veer-india

New Member
Joined
Jul 30, 2013
Messages
10
i AM A high school student.
In this excel document there is list of 100000 doctors. With their unique registeration number in a cell. Like this
Doc11234adhhrnier
Doc25678dscudcwofn
Doc39012ijwodnw
Doc11234fneoeirfj

<tbody>
</tbody>

Here entire row is not duplicate But the doctor appears in document 2-3 times. Having the same unique registration number. How i can remove the rows on the basis of one duplicate registeration number. ?
Thanks.
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Should work for you

Code:
Private Sub RemoveDup()
   '
   ' NOTE: You must select the first cell in the column and
   ' make sure that the column is sorted before running this macro
   '
   ScreenUpdating = False
   FirstItem = ActiveCell.Value
   SecondItem = ActiveCell.Offset(1, 0).Value
   Do While ActiveCell <> ""
      If FirstItem = SecondItem Then
             
        ActiveCell.Offset(1, 0).Select
         Selection.EntireRow.Delete
         ActiveCell.Offset(-1, 0).Select
         SecondItem = ActiveCell.Offset(1, 0).Value
      Else
        ActiveCell.Offset(1, 0).Select
        FirstItem = ActiveCell.Value
        SecondItem = ActiveCell.Offset(1, 0).Value
      End If
   Loop
   ScreenUpdating = True
End Sub
 
Upvote 0
Remove all rows or just the duplicates leaving one row? You want to leave the first row?
 
Upvote 0
first of all, sort them with their registration (Col B) or names (Col A).
add a helper column outside the dataset, Col G, say.

let say you sorted Col B,
put a simple formula if(B1=B2,"Y","N") and copy down, put a filter on Row 1, from the dropdown menu select "Y" and delete them all.
 
Upvote 0

Forum statistics

Threads
1,215,043
Messages
6,122,822
Members
449,096
Latest member
Erald

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top