How to delete duplicates in excel

Content on WhatAnswers is provided "as is" for informational purposes. While we strive for accuracy, we make no guarantees. Content is AI-assisted and should not be used as professional advice.

Last updated: April 4, 2026

Quick Answer: Excel offers a built-in 'Remove Duplicates' feature, accessible via the Data tab, which quickly identifies and deletes identical entries in your selected range. For more advanced scenarios or automated processes, you can use Power Query or VBA scripts to manage duplicate data.

Key Facts

Overview

Duplicate data can clutter your spreadsheets, lead to inaccurate analysis, and make it difficult to manage your information effectively. Fortunately, Microsoft Excel provides several robust methods to identify and remove these redundant entries. Whether you're dealing with a simple list or a complex dataset, understanding how to tackle duplicates is a fundamental Excel skill.

Using the 'Remove Duplicates' Feature

The most straightforward method for removing duplicates in Excel is the dedicated 'Remove Duplicates' tool. This feature is designed to quickly scan a selected range of cells and eliminate rows that contain identical values across specified columns.

Step-by-Step Guide:

  1. Select Your Data: Click and drag to highlight the range of cells containing the data you want to clean. If your data has headers, ensure they are included in the selection.
  2. Access the Tool: Navigate to the Data tab on the Excel ribbon. In the 'Data Tools' group, click on Remove Duplicates.
  3. Configure Options: A dialog box will appear, showing the columns within your selected range. By default, Excel selects all columns. You need to decide which columns should be considered when identifying duplicates. For instance, if you have a list of customers with names and email addresses, and you want to remove duplicate entries based on both name and email, ensure both columns are checked. If you only want to remove duplicates based on email address, uncheck the name column.
  4. Specify Headers: If your selection includes headers, make sure the 'My data has headers' checkbox is ticked. This tells Excel to ignore the first row when looking for duplicates.
  5. Execute Removal: Click OK. Excel will inform you how many duplicate values were found and removed, and how many unique values remain.

Important Considerations:

Advanced Techniques for Duplicate Management

While the 'Remove Duplicates' feature is excellent for simple tasks, more complex scenarios might benefit from other Excel functionalities.

1. Using Conditional Formatting to Identify Duplicates

Before removing duplicates, you might want to visually identify them. Conditional Formatting can highlight duplicate values, allowing you to review them before deletion.

  1. Select the range of cells you want to analyze.
  2. Go to the Home tab, click Conditional Formatting, then Highlight Cells Rules, and choose Duplicate Values.
  3. Select a formatting style (e.g., light red fill with dark red text) and click OK.

This will visually mark all duplicate entries within your selected range. You can then manually review and delete them, or use this as a precursor to using the 'Remove Duplicates' tool.

2. Leveraging Power Query for Robust Duplicate Removal

Power Query (Get & Transform Data) is a powerful data manipulation tool built into Excel (available in Excel 2016 and later, and as an add-in for earlier versions). It's ideal for handling larger datasets, performing complex transformations, and automating data cleaning processes.

Steps with Power Query:

  1. Load Data into Power Query: Select your data range or table. Go to the Data tab, and in the 'Get & Transform Data' group, click From Table/Range.
  2. Remove Duplicate Columns: In the Power Query Editor, right-click on the column header you want to base the duplicate removal on. Select Remove Duplicates. If you need to consider multiple columns, select them (hold Ctrl or Shift), right-click on one of the selected headers, and choose Remove Duplicates.
  3. Load Data Back to Excel: Once you're satisfied with the preview, go to the Home tab in Power Query Editor and click Close & Load. This will load the cleaned data into a new worksheet or refresh an existing table.

Power Query is particularly useful because it records all the steps you take. If your data source updates, you can simply refresh the Power Query connection, and it will reapply all the cleaning steps, including duplicate removal, automatically.

3. Using VBA (Visual Basic for Applications)

For users who need highly customized or automated solutions, VBA macros can be employed. This requires some programming knowledge but offers the ultimate flexibility.

Example VBA Code Snippet:

Sub RemoveDuplicatesMacro()Dim ws As WorksheetDim tbl As ListObjectDim rng As RangeSet ws = ThisWorkbook.Sheets("Sheet1") ' Change Sheet1 to your sheet nameOn Error Resume NextSet tbl = ws.ListObjects("Table1") ' Change Table1 to your table name, if applicableOn Error GoTo 0If Not tbl Is Nothing ThenSet rng = tbl.DataBodyRangeElse' If not a table, define a range (e.g., A1 to last used cell)Set rng = ws.Range("A1").CurrentRegionEnd IfIf Not rng Is Nothing Thenrng.RemoveDuplicates Columns:=Array(1, 2), Header:=xlYes ' Adjust Columns and Header as neededMsgBox "Duplicates removed successfully!"ElseMsgBox "No data found or range could not be determined."End IfEnd Sub

This macro removes duplicates based on the first two columns (Columns 1 and 2) of a specified range or table, assuming headers are present. You can customize the `Columns` array to include the indices of the columns you want to check for duplicates, and adjust `Header` accordingly.

Conclusion

Effectively managing duplicate data in Excel is crucial for maintaining data integrity and efficiency. By utilizing the built-in 'Remove Duplicates' tool, visual cues from Conditional Formatting, the powerful automation capabilities of Power Query, or the customizability of VBA, you can ensure your spreadsheets are clean, accurate, and reliable.

Sources

  1. Find and remove duplicates - Microsoft Supportfair-use
  2. VBA Code to Remove Duplicate Rows in Excelfair-use
  3. Remove duplicate rows (Power Query) - Microsoft Docsfair-use

Missing an answer?

Suggest a question and we'll generate an answer for it.