To remove duplicate rows in Excel without losing data, copy your sheet first, check the duplicates, then use Data, Remove Duplicates on the copy. Microsoft says removing duplicates permanently deletes them, so it advises copying the original range or table to another worksheet or workbook first. You can look before you delete: highlight duplicates with Conditional Formatting, or use Data, Advanced, Unique records only to copy the unique rows to a new place, which leaves your original data untouched. Choose the columns to compare with care, because Excel deletes the whole row when the selected columns match. Here are the steps, which row Excel keeps, common traps and what I could not confirm.
Step 1: Back Up Your Data
- Right-click the sheet tab and choose Move or Copy, then tick Create a copy. Or save the workbook under a new name. These are general ways to make a backup.
- Microsoft’s advice is to copy the original range or table to another worksheet or workbook before removing duplicates.
- Work on the copy. If you make a mistake, press Ctrl+Z, which Microsoft lists as the way to undo Remove Duplicates.
Step 2: Find the Duplicates First
Microsoft says to filter on, or conditionally format, the unique values first, to confirm you get the results you expect before you remove anything.
- Select the cells to check.
- Go to Home, Conditional Formatting, Highlight Cells Rules, Duplicate Values.
- Choose a format for the duplicates and click OK.
The rule applies only to the cells you selected. It cannot be used in the Values area of a PivotTable. If you highlight one column, it finds repeated values in that column only, not whole repeated rows. This last sentence is my own reading of the “selected cells” rule, so check a few rows by eye.
Option A: Keep the Original and Copy the Unique Rows (Safest)
This uses Microsoft’s Advanced Filter, and it does not delete anything from the original.
- Select the range, or click a cell inside a table.
- Go to Data, Advanced (in the Sort & Filter group).
- Choose Copy to another location, and enter a cell reference in the Copy to box. Choose an empty area, or a new sheet.
- Tick Unique records only, then click OK.
Microsoft says the unique values are copied to the new location. The other choice, Filter the list, in-place, hides the duplicates temporarily, and the Microsoft page says filtering only hides them. So the copy method keeps your original list.
Option B: Remove Duplicates on the Copy
- Select the range, or click a cell inside a table.
- On the Data tab, click Remove Duplicates (in the Data Tools group).
- Under Columns, select the columns to compare. Use Select All or Unselect All to change the selection quickly.
- Click OK. A message shows how many duplicates were removed or how many unique values remain. Click OK again.
Another Microsoft page says to uncheck any column whose data you need to keep, such as a price column. The Microsoft pages I read do not mention a “My data has headers” box, though Excel may show one. Check that your header row is not treated as data. This last sentence is general advice.
How Excel Decides What Is a Duplicate
- The columns you tick decide. Excel judges duplicates by the combination of the selected columns. If they match, the whole row is removed, including the columns you did not select.
- The first row stays. Excel keeps the first occurrence and deletes the later identical rows.
- Displayed values count. Microsoft says the comparison uses what is displayed in the cell, not the stored value. Its example is that “3/8/2006” and “Mar 8, 2006” are treated as unique.
- Only the selection changes. Values outside the selected range or table do not change or move.
Example: What Could Go Wrong
| Name | City | Phone |
|---|---|---|
| Ali Khan | Lahore | 0300-1111111 |
| Ali Khan | Lahore | 0300-2222222 |
These rows and names are my own example. If you tick only Name and City, Excel treats the two rows as duplicates, and deletes the second row, including its different phone number. If you also tick Phone, both rows stay. To avoid losing data, tick every column that matters, or review the rows by eye first.
Things to Check Before You Start
- Outlines and subtotals. Microsoft says you cannot remove duplicates from data that is outlined or has subtotals. Remove the outline and subtotals first.
- Blank cells and spaces. Microsoft says the counts after removal may include empty cells or cells with spaces.
- Formulas. I did not find what Microsoft says about formulas in the rows. Test a small sample first. This is general advice.
- Several sheets. The Microsoft pages I read do not explain how to find duplicates across worksheets.
What I Could Not Confirm
- Upper and lower case, extra spaces and spelling. I did not find a Microsoft statement on whether “Ali” and “ali”, or a name with a trailing space, count as the same. Microsoft says only that the displayed value is compared. Test a few rows, and clean the data first if needed.
- The “My data has headers” option. The Microsoft pages I read do not mention it.
- Excel for the web, Mac and phone. I did not check menu differences. The steps follow the desktop menu names in Microsoft’s pages.
- Which Excel versions. I did not check older versions.
- Formulas and tables with merged cells. I did not find a source on how Remove Duplicates handles them.
- Power Query and formulas like UNIQUE. Search results show Microsoft pages on Power Query and the UNIQUE function. I did not open them, so I give no steps.
- Large files. I did not check any limit on the number of rows.
- Other programs. I did not check Google Sheets, WPS Office or LibreOffice.
This is general information, not an official notice. Microsoft is the final authority on its own menus.
Frequently Asked Questions
How do I remove duplicate rows in Excel?
Select the range, go to Data, Remove Duplicates, tick the columns to compare and click OK. Copy your data first, because removal is permanent.
How do I remove duplicates without losing the original data?
Use Data, Advanced, choose Copy to another location and tick Unique records only. The unique rows are copied, and your original list stays as it is.
Which duplicate does Excel keep?
The first one. Later identical rows are deleted.
Why was a row deleted when its other columns were different?
Excel compares only the columns you tick. If those match, it removes the whole row, including the columns you did not tick.
Can I undo Remove Duplicates?
Microsoft says to select Undo or press Ctrl+Z. After you save and close, a backup copy is the safer way.
How do I see the duplicates before I remove them?
Use Home, Conditional Formatting, Highlight Cells Rules, Duplicate Values.
Why is Remove Duplicates not working?
Microsoft says it cannot remove duplicates from outlined data or data with subtotals. Remove those first.
Check the result against your backup copy before you delete the original.
