Guides
/

Data analysis

Remove Duplicates

How to remove duplicates in Excel: find, highlight and delete them

How to find and remove duplicate rows in Excel: the Remove Duplicates button, highlighting, UNIQUE and COUNTIF formulas, and common pitfalls.

Example

A
1Customer
2Aziz
3Dilnoza
4Aziz
5Jasur
6Dilnoza
7Aziz

Formula:

=COUNTA(UNIQUE(A2:A7))

→ result: 3

Remove Duplicates step by step

1. Click any cell in the table (or select the whole table). 2. Data → Remove Duplicates. From the keyboard: Alt → A → M. 3. Make sure “My data has headers” is ticked so the header row isn’t removed. 4. Tick the columns to check for duplicates and click OK. Excel reports the result: how many duplicate values were found and removed and how many unique values remain. From each group of duplicates the top (first) row is kept and the rows below it are deleted.

Which columns to select

• All columns ticked — only rows that are identical in every cell are removed. • One column ticked (e.g. Phone) — every row with a repeated phone number is deleted entirely, even if other columns differ. • Two columns (Name + Date) — a row counts as a duplicate only when both values match. Tip: if it matters which copy survives (say, the latest order), sort the table first so the row you want is on top of each group — Remove Duplicates keeps the first one.

Careful: the data is deleted for good

Remove Duplicates really deletes rows — it doesn’t hide them. So: • Make a copy of the sheet before you start (Ctrl-drag the sheet tab). • Made a mistake? Press Ctrl+Z right away — once the file is saved and closed, the rows can’t be brought back. • If you select just one column, Excel asks whether to “Expand the selection” or “Continue with the current selection”. Almost always expand: otherwise only that column shrinks and the rows get misaligned — Aziz’s phone number ends up in Dilnoza’s row.

Look first: highlight duplicates

It’s safer to see the duplicates before deleting them. Select the column → Home → Conditional Formatting → Highlight Cells Rules → Duplicate Values. Every repeated value gets colored. Then use Filter → Filter by Color to show only the colored rows and review them by hand. This is especially useful in a customer list: “Aziz Karimov” appears twice — is it a duplicate or two different people? Check the phone or address to decide.

The formula way: UNIQUE and COUNTIF

Formulas let you work without touching the original data. UNIQUE — in Excel 365 and 2021: =UNIQUE(A2:A100) spills a duplicate-free list into the cells next to it and updates when the source changes. The example formula =COUNTA(UNIQUE(A2:A7)) counts the distinct customers: Aziz, Dilnoza, Jasur — 3, even though there are 6 rows. =UNIQUE(A2:A100,,TRUE) returns only the values that appear exactly once. A COUNTIF flag works in any version: enter =COUNTIF($A$2:A2,A2)>1 in B2 and fill down. The start of the range is locked and the end grows as you go down, so the first occurrence returns FALSE and every later repeat returns TRUE. Then filter for TRUE and delete or analyze those rows.

Advanced Filter: a copy without duplicates

Excel 2016/2019 has no UNIQUE, but you can still get a duplicate-free list and keep the original: 1. Select the table. 2. Data → Advanced (Alt → A → Q). 3. Choose “Copy to another location” and point Copy to at an empty cell. 4. Tick “Unique records only” and click OK. You get a de-duplicated copy in the new location while the original stays unchanged. The downside: when the source changes, you have to run it again.

Why duplicates aren’t detected

• Extra spaces: “Aziz ” and “Aziz” are different to Excel. Clean them in a helper column with =TRIM(A2) and look for duplicates there. Text copied from websites may contain non-breaking spaces: =TRIM(SUBSTITUTE(A2,CHAR(160)," ")). • Different display: Remove Duplicates compares values as they are displayed. If the same date shows as 3/8/2025 in one cell and “March 8, 2025” in another, they aren’t treated as duplicates. Apply one format first. • Letter case: “AZIZ” and “Aziz” are treated as duplicates — neither Remove Duplicates nor UNIQUE is case-sensitive. • Invisible differences: a Cyrillic “А” vs a Latin “A”, a zero vs the letter “O”. Compare the lengths with LEN.

Counting duplicates

• Number of distinct values (Excel 365): =COUNTA(UNIQUE(A2:A100)). • Number of distinct values (Excel 2016/2019, column without blanks): =SUMPRODUCT(1/COUNTIF(A2:A100,A2:A100)). • How many rows are extra (would be removed): =COUNTA(A2:A100)-COUNTA(UNIQUE(A2:A100)). • How many times a specific value appears: =COUNTIF(A2:A100,"Aziz"). These numbers should match the message from the Remove Duplicates dialog — a handy check before you delete anything.

Has ExcelLab been useful?

Support the project and help us release new lessons and exercises.

Support us

Frequently asked questions

Click a cell in the table, go to Data → Remove Duplicates (or press Alt → A → M), tick the columns to check and click OK. The first row of each group of duplicates is kept.
Highlight them with Conditional Formatting → Highlight Cells Rules → Duplicate Values, or use =COUNTIF($A$2:A2,A2)>1 in a helper column — rows showing TRUE are repeats. In Excel 365, =UNIQUE(A2:A100) lists the values without duplicates in a separate place.
The top row of each group. If you need to keep, for example, the most recent order, sort by date in descending order first and then remove duplicates.
Usually the values contain extra spaces or invisible characters, or dates and numbers are displayed in different formats. Clean the text with TRIM, make the formats consistent and try again.
Yes, if you press Ctrl+Z immediately. After the file has been saved and closed, only a backup can help — so copy the sheet first or use methods that leave the original untouched, such as UNIQUE or Advanced Filter.