Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

How to Get Rid of Duplicates in Excel

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To remove duplicates in Excel, select your data range, go to the Data tab, and click Remove Duplicates. This instantly deletes duplicate rows, keeping only the first occurrence. If you need more control, you can use advanced filters or formulas. This guide covers all methods, including how to avoid common mistakes and troubleshoot when things go wrong.

What You'll Need

  • Microsoft Excel (2016, 2019, 2021, or Microsoft 365) – the steps are similar across versions, but menu labels may vary slightly.
  • A spreadsheet with data that may contain duplicates (e.g., a list of names, emails, or product IDs).
  • Basic familiarity with selecting cells and using Excel's ribbon tabs.

Step-by-Step

Method 1: Using the Built-In Remove Duplicates Tool

  1. Select the data range – Click and drag to highlight the cells that contain your data. Include the header row if you have one. For example, if your data is in columns A to D, rows 1 to 100, select A1:D100.
  2. Go to the Data tab – In the ribbon at the top of Excel, click the Data tab.
  3. Click Remove Duplicates – In the “Data Tools” group, you’ll see a button labeled Remove Duplicates. Click it.
  4. Choose which columns to check – A dialog box appears. If your data has a header row, ensure “My data has headers” is checked. Then, select the columns where you want to find duplicates. For instance, if you only want to remove rows with the same email address, uncheck other columns so only “Email” is selected. If you want to remove rows that are identical across all columns, leave all columns checked.
  5. Click OK – Excel will scan the selected columns and remove duplicate rows. A message will show how many duplicates were removed and how many unique values remain. Click OK to close the message.

Method 2: Using Advanced Filter (For Copying to Another Location)

  1. Select your data range – Highlight the range including headers.
  2. Go to the Data tab – Click the Advanced button in the “Sort & Filter” group (it’s usually next to the Filter icon).
  3. Set the options – In the Advanced Filter dialog, choose “Copy to another location” if you want to keep the original data intact. For “List range,” ensure your selected range is correct. For “Copy to,” click in the field and select an empty cell where the filtered list will start (e.g., F1). Check “Unique records only.”
  4. Click OK – Excel will copy the unique rows to the new location. The original data remains unchanged.

Method 3: Using Formulas to Identify Duplicates

  1. Add a helper column – Insert a new column next to your data (e.g., column E if your data is A:D).
  2. Enter a formula – In the first cell of the helper column (E2), enter: =COUNTIF($A$2:$A$100, A2) (adjust the range to match your data). This counts how many times the value in A2 appears in the entire range.
  3. Copy the formula down – Drag the fill handle (the small square at the bottom-right of the cell) down to the last row of your data.
  4. Filter for duplicates – Select the helper column, go to the Data tab, and click Filter. Click the dropdown arrow in the helper column header and uncheck “1” to show only rows where the count is greater than 1. These are your duplicates.
  5. Delete or review – You can delete these rows manually, or copy them to another sheet for review.

Common Mistakes

  • Not selecting the entire range – If you select only one column, Excel will remove rows that have duplicates in that column, but it will keep the first occurrence and delete the rest, even if other columns differ. This can cause data loss.
  • Ignoring the header row – If you forget to check “My data has headers,” Excel treats the header as a data row, which can lead to the header being removed or the first data row being considered a duplicate.
  • Applying Remove Duplicates to a filtered list – If you have filters active, Remove Duplicates only works on visible cells, which may not remove all duplicates.
  • Assuming case sensitivity – Excel’s Remove Duplicates is case-insensitive by default. “John” and “john” are considered duplicates. If you need case-sensitive removal, you’ll need a formula-based approach.

Tips

  • Always make a backup – Before removing duplicates, copy your worksheet or save a version of the file. This is crucial because Remove Duplicates permanently deletes data.
  • Use conditional formatting to highlight duplicates first – Select your data, go to the Home tab, click Conditional Formatting > Highlight Cells Rules > Duplicate Values. This will visually mark duplicates so you can review them before deleting.
  • Remove duplicates in a copy – If you’re unsure, copy the data to a new sheet and run Remove Duplicates there. That way, the original stays intact.
  • Check for leading or trailing spaces – Excel may not recognize “John” and “John ” (with a space) as duplicates. Use the TRIM function to clean your data first: =TRIM(A2).

Troubleshooting

If Remove Duplicates didn’t remove all duplicates:

  1. Check for extra spaces – Use the TRIM function to remove leading/trailing spaces, then try again.
  2. Check for different data types – If some cells are numbers and others are text (e.g., “123” vs. “123”), Excel treats them as different. Convert all to the same format.
  3. Ensure you selected the correct columns – If you only selected one column, duplicates in other columns won’t be considered. Make sure you select all columns that define a unique record.

If you accidentally deleted data:

  1. Undo immediately – Press Ctrl+Z (Windows) or Cmd+Z (Mac) right after the removal to undo it.
  2. Check the Recycle Bin – If you saved and closed the file, you might be able to recover a previous version from the Recycle Bin (Windows) or Trash (Mac).
  3. Use Version History – If you’re using OneDrive or SharePoint, right-click the file in File Explorer and select “Version History” to restore an earlier version.

If the Remove Duplicates button is greyed out:

  1. Check if the sheet is protected – Go to the Review tab and click Unprotect Sheet if it is protected.
  2. Check if you’re in edit mode – Press Enter to exit cell editing, then try again.

Frequently Asked Questions

Can I remove duplicates based on one column while keeping other columns?

Yes. In the Remove Duplicates dialog, uncheck all columns except the one you want to base the duplicate check on. Excel will keep the first occurrence of each value in that column and delete the rest, even if other columns differ.

Does Remove Duplicates work on multiple columns at once?

Yes. You can select multiple columns in the dialog. Excel will only remove rows that have identical values in all selected columns.

Will Remove Duplicates delete my original data?

Yes, it permanently deletes duplicate rows from your selected range. To avoid this, use the Advanced Filter method to copy unique records to a new location, or make a backup first.

How do I count duplicates without removing them?

Use the COUNTIF formula: =COUNTIF(range, cell). For example, =COUNTIF($A$2:$A$100, A2) returns the number of times the value in A2 appears. Then use conditional formatting to highlight cells where the count is greater than 1.

Can I remove duplicates in Excel Online?

Yes, Excel Online has the same Remove Duplicates feature. Select your data, go to the Data tab, and click Remove Duplicates. The steps are identical.

What if I have a large dataset (100,000+ rows)?

Remove Duplicates can handle large datasets, but it may be slow. For very large data, consider using Power Query (Get & Transform) – go to Data > From Table/Range, then in the Power Query editor, select the columns and use “Remove Duplicates” from the Home tab. This is often faster and more flexible.