Excel Duplicate Filter: How to Find and Remove Duplicates
In this article
To put a duplicate filter in Excel, you can use Conditional Formatting to highlight duplicates or the Remove Duplicates tool to delete them entirely. If you want to simply hide duplicates while keeping the data, the best method is to use the Advanced Filter option. These tools allow you to clean your datasets, ensure data integrity, and remove redundant entries that can skew your analysis or reporting.
What You'll Need
- A computer with Microsoft Excel installed (Windows or macOS).
- A dataset containing columns of information where you suspect duplicate entries exist.
- A backup copy of your data (recommended), as some removal methods permanently delete rows.
Step-by-Step
Depending on whether you want to see the duplicates, hide them, or delete them, follow the corresponding method below. Note that menu labels may differ slightly depending on your version of Excel or regional settings.
Method 1: Highlighting Duplicates (Visual Filter)
This method does not remove data but applies a color to duplicate cells so you can manually review them before taking action.
- Open your Excel workbook and select the range of cells, the specific column, or the entire table you want to check for duplicates.
- Navigate to the Home tab on the top ribbon.
- In the Styles group, click on Conditional Formatting.
- Hover your mouse over Highlight Cells Rules and then select Duplicate Values... from the side menu.
- A dialog box will appear. In the first dropdown, ensure Duplicate is selected. In the second dropdown, choose your preferred formatting style (e.g., "Light Red Fill with Dark Red Text").
- Click OK. All duplicate entries in the selected range will now be highlighted.
- To filter these visually, click the filter arrow in your column header, select Filter by Color, and choose the color you just applied.
Method 2: Using Advanced Filter to Hide Duplicates
Use this method if you want to create a unique list of values without deleting the original data from your primary table.
- Select the column or range of data you wish to filter.
- Go to the Data tab on the ribbon.
- In the Sort & Filter group, click the Advanced button.
- In the Advanced Filter dialog box, choose whether you want to Filter the list in-place (which hides the duplicates) or Copy to another location (which creates a new, clean list elsewhere).
- If you chose "Copy to another location," click into the Copy to box and select an empty cell on your worksheet where the unique list should start.
- Check the box labeled Unique records only at the bottom of the dialog box.
- Click OK. Excel will now hide all duplicate rows or generate a new list containing only one instance of each value.
Method 3: Removing Duplicates Permanently
This is the fastest way to clean a dataset, but it is destructive. Use this only if you are certain you do not need the redundant data.
- Click any single cell inside your data range or table to ensure Excel recognizes the boundaries of your dataset.
- Navigate to the Data tab on the ribbon.
- In the Data Tools group, click the Remove Duplicates button.
- A dialog box will appear listing all the columns in your selection.
- If you want to remove rows where every column is identical, leave all columns checked. If you only care about duplicates in one specific column (e.g., "Email Address"), uncheck all other columns and check only that specific one.
- If your data has headers (e.g., "Name", "Date", "ID"), ensure the My data has headers box is checked.
- Click OK. Excel will display a summary message telling you how many duplicate values were found and removed, and how many unique values remain.
Common Mistakes
One of the most frequent errors is failing to select the entire dataset before using the Remove Duplicates tool. If you select only one column and click Remove Duplicates, Excel will delete the data in that column but leave the data in the adjacent columns untouched. This results in "shifted" data, where the information in Row 5 might now be paired with the information that used to be in Row 10, completely destroying the integrity of your records.
Another common mistake is ignoring leading or trailing spaces. Excel treats "Apple" and "Apple " (with a space at the end) as two different values. If your duplicate filter isn't catching obvious repeats, it is often because of hidden spaces or non-printing characters imported from another software or web source.
Lastly, users often forget to back up their data before using the Remove Duplicates tool. Unlike the Advanced Filter or Conditional Formatting, Remove Duplicates permanently alters the worksheet. While you can use the Undo (Ctrl+Z) command immediately after the action, if you save and close the file, those deleted rows are gone forever.
Tips
To handle the "hidden space" issue mentioned above, use the TRIM function before applying your duplicate filter. You can create a helper column and use the formula =TRIM(A2) to remove all extra spaces from cell A2. Once you have trimmed the data, copy the results and use Paste Special > Values to replace the original messy data with the clean version.
If you are working with a very large dataset (tens of thousands of rows), using the UNIQUE function (available in Excel 365 and Excel 2021) is significantly faster than the Advanced Filter. Simply type =UNIQUE(A2:A10000) into an empty cell, and Excel will automatically "spill" a list of every unique value found in that range into the cells below.
For those who need to keep a record of why something was marked as a duplicate, use Conditional Formatting first. This allows you to manually inspect the duplicates. For example, you might find that two "John Smiths" are actually two different people who happen to have the same name, in which case you wouldn't want to delete one of them.
Troubleshooting
If the duplicate filter is not finding values that look identical to you, check for data type mismatches. A common scenario is when one cell is formatted as Text and another as a Number. Even if both look like "12345", Excel treats them as different entities. To fix this, select the column, go to the Data tab, select Text to Columns, and click Finish immediately. This usually forces all cells in the column into a consistent format.
If the Remove Duplicates button is greyed out, it is likely because your worksheet is protected or you are currently editing a cell (the cursor is blinking inside a cell). Press Enter or Esc to exit the cell edit mode, or go to the Review tab and check if the sheet is protected. If it is, you must unprotect it with the password before you can modify the data structure.
If the Advanced Filter is not copying data to the new location, ensure the destination cell is completely empty and not part of an existing Excel Table (formatted with Ctrl+T). Advanced Filters sometimes struggle to output data directly into a pre-defined Table object; try selecting a blank area of the sheet instead.
Frequently Asked Questions
Can I filter duplicates across multiple columns?
Yes. In the Remove Duplicates dialog box, check multiple columns. Excel will only remove a row if the values in all selected columns match exactly.
Does the duplicate filter work in real-time?
Conditional Formatting works in real-time; if you type a duplicate value, it will turn red instantly. However, the Remove Duplicates and Advanced Filter tools are static and must be re-run whenever new data is added.
How do I remove only the second instance of a duplicate?
The Remove Duplicates tool is designed specifically for this; it keeps the first occurrence it finds and deletes all subsequent identical entries.
Is there a way to count how many times a value is duplicated?
Yes, use the =COUNTIF(Range, Criteria) formula. For example, =COUNTIF(A:A, A2) will tell you how many times the value in A2 appears in column A.
Will this work on Excel for Web?
Yes, the Remove Duplicates feature is available in Excel for the Web under the Data tab, though some Advanced Filter options may be more limited than the desktop version.