
How to Remove Duplicates in Excel: Three Ways, and Which Row Gets Deleted
Select your data, choose Data > Remove Duplicates, tick the columns that define a duplicate and select OK. Excel keeps the first row of each match and deletes the rest for good. Here are the steps, the safer UNIQUE route, and why it sometimes misses duplicates.
Tech Talk News Editorial
7 min read
Key takeaways
- To remove duplicates in Excel, select the range, choose Data > Remove Duplicates, tick the columns that define a duplicate and select OK; Excel keeps the first occurrence of each value and permanently deletes later identical rows.
- The columns you tick form the matching key, but Microsoft says data is removed from all columns, so ticking only an email column deletes the whole row of every later match, including its other fields.
- The UNIQUE function (=UNIQUE(A2:C500)) returns a duplicate-free list without touching the original data, and it is available in Excel for Microsoft 365, Excel for the web, Excel 2024 and Excel 2021, but not Excel 2019 or 2016.
- Excel judges duplicates by the value displayed in the cell, so the dates 3/8/2006 and Mar 8, 2006 count as unique, and it cannot remove duplicates from data that has an outline or subtotals.
- Google Sheets uses Data > Data cleanup > Remove duplicates and treats values that differ only in letter case, formatting or formulas as duplicates.
On this page7 sections
To remove duplicates in Excel, select your data, go to Data > Remove Duplicates, tick the columns that decide what counts as a duplicate, and select OK. Excel keeps the first row of each match and deletes the rest.[1]
That deletion is permanent, and it is the reason I run one of the other two methods first. The steps below are checked against Microsoft's current Support pages for Excel for Microsoft 365 on Windows, Mac and the web, as of November 29, 2026.
Remove duplicates with the button: the steps
- Copy the sheet first. Right-click its tab, choose Move or Copy and tick Create a copy. Microsoft's own advice is to copy the original range to another sheet before you start.[1]
- Select the range, or click any cell inside the table.
- On the Data tab, in the Data Tools group, select Remove Duplicates.
- Under Columns, tick the columns Excel should compare. Tick My data has headers if row 1 is a header row. Select All and Unselect All speed this up.
- Select OK. A message tells you how many duplicates were removed and how many unique values remain. Select OK again to close it.
- If the count looks wrong, press Ctrl+Z now. Undo works right after the removal.[1]
In Excel for the web the dialog works the other way round. Clear the columns you don't want used for matching, then select OK twice.[1]
Which columns to tick decides which rows die
This is the step people get wrong, and the dialog doesn't warn you. The columns you tick form the matching key. Microsoft is blunt about what follows: data is removed from all columns, even if you don't select all of them, and the whole row goes when a match is found.[1]
Here is a three-column list with a customer, an email and an order date.
- Ana, ana@example.com, Jan 5
- Ana, ana@example.com, Feb 9
- Ben, ben@example.com, Feb 9
Tick only the Email column and Excel sees two rows with the same email. It keeps the Jan 5 row and deletes the Feb 9 order. You're left with two rows and a lost sale.
Tick all three columns and every row is unique, so nothing is removed. Tick Customer and Email and you again lose the Feb 9 row.
Decide what a duplicate means in your data before you open the dialog: the same person, or the same record.
Heads up
Method 2: highlight duplicates first, delete nothing
When the data matters, look before you cut. Conditional formatting colors the repeats so you can judge them yourself.
- Select the cells you want to check.
- On the Home tab, select the arrow next to Conditional Formatting.
- Choose Highlight Cells Rules > Duplicate Values, pick a format and select OK.[1]
Two limits. The rule colors every copy, including the first, so it shows you where the repeats live rather than which to delete.
And if you select several columns, it flags any value that appears twice anywhere in the selection. It doesn't flag duplicate rows.
To flag a repeat in one column only, use a formula rule: in Manage Rules, choose Use a formula to determine which cells to format. Microsoft's own example for the column A2:A400 is =COUNTIF($A$2:$A$400,A2)>1.[1]
Microsoft also lists a rule you can't use: unique or duplicate formatting doesn't work on the Values area of a PivotTable.[1]
Method 3: the UNIQUE function, my default
=UNIQUE(A2:C500) returns a list of the unique rows in a range and leaves the original alone.[2] You get a clean copy in new cells, and the source stays intact for the day someone asks where a row went. I'd rather use this than the button on anything I can't easily recreate.
=UNIQUE(array, [by_col], [exactly_once]). By default it compares rows. Set by_col to TRUE to compare columns.[2]- Set exactly_once to TRUE and it returns only the rows that occur exactly once. Microsoft's example lists customers who used a service only once.[2]
- Sort the result by wrapping it:
=SORT(UNIQUE(B2:B12)).[2] - If the source is an Excel table and you use structured references, the output resizes as you add or remove data.[2]
UNIQUE is in Excel for Microsoft 365, Excel for the web, Excel 2024 and Excel 2021. It is not in Excel 2019 or 2016, which is why the button is still worth knowing.[2] To turn the result into plain values, copy it and use Paste Special > Values.
There is a fourth option for older versions. Select the data, choose Data > Advanced, pick Copy to another location, enter a cell in the Copy to box and tick Unique records only. It writes the unique rows elsewhere and doesn't delete anything.[1]
Takeaway
Remove Duplicates is a delete button, UNIQUE is a copy machine. Use the button on a throwaway copy, and use UNIQUE or a highlight when the data is the only one you have.
If Excel misses duplicates, or won't run
- The values only look identical. Excel compares what is displayed. A date shown as 3/8/2006 in one cell and Mar 8, 2006 in another counts as unique.[1] Apply one number format to the column and try again.
- A trailing space. "Ana" and "Ana " are different text. Put
=TRIM(A2)in a helper column, fill it down, paste the result back as values, then remove duplicates. - Outline or subtotals. Microsoft says you can't remove duplicates from outlined data or data that has subtotals. Remove the outline and the subtotals first (Data > Subtotal > Remove All clears the subtotals).[1]
- It removed too much. You probably ticked too few columns. Press Ctrl+Z, then rerun with the full set of columns that define a record.
- Double-byte languages. If your proofing language is one that uses double-byte characters, such as Japanese, halfwidth and fullwidth characters are treated as equal. Microsoft says to use the COUNTIF formula rule above to tell them apart.[1]
Duplicates often come from lookups gone wrong. If you're matching two lists and getting repeats, the cleaner fix is a proper lookup, which XLOOKUP in Excel covers. And if the column should only ever hold approved values, stop bad entries at the source with a drop-down list.
Remove duplicates in Google Sheets
Google Sheets has a built-in tool too. Highlight the range, then choose Data > Data cleanup > Remove duplicates. Pick the columns, say whether the data has a header row and confirm.[3]
The difference to know: Google counts cells with identical values but different letter case, formatting or formulas as duplicates. So Ana and ANA match in Sheets.
And if you select a single cell inside a range, Sheets checks the whole range.[3] Sheets also has its own UNIQUE function, and if you work there for statistics, standard deviation in Google Sheets is the next cleanup question.
Primary sources
- 1.PrimaryFilter for unique values or remove duplicate values. Microsoft Support. Steps, behavior and limits for Remove Duplicates, Advanced filter and conditional formatting.
- 2.PrimaryUNIQUE function. Microsoft Support. Syntax, arguments and the list of Excel versions that include it.
- 3.PrimarySplit text, remove duplicates, or trim whitespace. Google Docs Editors Help. Data cleanup in Google Sheets.
Frequently asked questions
6 questions
How do I remove duplicates in Excel?
Select your data, go to Data > Remove Duplicates, tick the columns that should match, and select OK. Excel keeps the first occurrence of each value, deletes the later rows and shows a message with how many duplicates it removed. Press Ctrl+Z right away if the result is wrong.
Does Excel keep the first or last duplicate?
Excel keeps the first one. Microsoft says the first occurrence of each value stays and later identical rows are deleted. To keep the newest record instead, sort the data so the newest row comes first, then run Remove Duplicates.
How do I find duplicates in Excel without deleting them?
Select the cells and choose Home > Conditional Formatting > Highlight Cells Rules > Duplicate Values. Excel colors every cell whose value appears more than once, including the first copy, and deletes nothing. The UNIQUE function and the Advanced filter with Unique records only are two other no-delete options.
Why does Remove Duplicates miss rows that look identical?
Excel compares the displayed value, and a hidden difference such as a trailing space or a different date format makes two rows unique. Microsoft gives the example of 3/8/2006 and Mar 8, 2006, which count as different. Clean the cells with TRIM or a single number format, then run it again.
Can I remove duplicates in Excel with a formula?
Yes, in Excel for Microsoft 365, Excel for the web, Excel 2024 and Excel 2021. =UNIQUE(A2:C500) spills the list of unique rows into new cells and leaves your source data alone. Excel 2019 and 2016 do not have UNIQUE, so use Remove Duplicates or the Advanced filter there.
How do I remove duplicates in Google Sheets?
Select the range, choose Data > Data cleanup > Remove duplicates, pick the columns and say whether you have a header row. Google counts cells with identical values but different letter case, formatting or formulas as duplicates, so Ana and ANA match there.
Keep reading
Written by
Tech Talk News Editorial
Computer engineering background. Writes about software, AI, markets, and real estate, and the places where the three meet.
About Tech Talk News

