Excel Guides

Removing Duplicate Rows in Excel

There are a few ways to remove duplicate rows in Excel. One way is to use the Remove Duplicates feature. To do this, select the data you want to check for duplicates, click Data on the ribbon, and then click Remove Duplicates. In the Remove Duplicates dialog box, select the column or columns that contain the duplicates, and then click OK. Excel will remove the duplicate rows and leave the unique rows.

Another way to remove duplicate rows is to use a macro. The following macro will delete all rows that have duplicates in column A. To use this macro, select the data you want to check for duplicates, press Alt+F8, and then run the macro:

Sub DeleteDuplicates()
    Dim rng As Range
    Dim cell As Range
    Dim dict As Object

    Set rng = Selection
    Set dict = CreateObject("Scripting.Dictionary")

    For Each cell In rng
        If dict.Exists(cell.Value) Then
            cell.EntireRow.Delete
        Else
            dict.Add cell.Value, Nothing
        End If
    Next cell

    Set dict = Nothing
End Sub

Move beyond 

Excel

Get started with Causal today.
Build models effortlessly, connect them directly to your data, and share them with interactive dashboards and beautiful visuals.