# How to Remove Duplicates in Excel Without Deleting Rows You Need

What Excel actually compares when it calls two rows duplicates, how to preview the matches with a helper column, and how to fix the stray spaces and text numbers that hide real duplicates.

> data cleaning · conditional formatting · countifs · About 7 min · Nov 3

## Key points

1. Excel calls two rows duplicates when they match exactly in every column you tick, keeps the first occurrence and deletes later ones — but it deletes the whole row, including columns you did not tick.
2. The comparison uses what each cell displays, not what is stored, so a trailing space, a text-formatted number, or one date in two formats prevents a match.
3. Ticking one column does not deduplicate that column; it deletes whole records based on that column, which is how bookings and notes disappear.
4. A conditional-formatting Duplicate Values rule previews repeated values inside one column, while a COUNTIFS helper column previews whole-row matches; any count above 1 marks a row the command would delete.
5. Clean values first with TRIM, adding SUBSTITUTE with CHAR(160) for non-breaking spaces, and paste the result back as values, because the command compares cells in place.
6. Sort before running it, since the surviving row is simply the first one in sheet order.
7. Verify the dialog's two numbers against the helper column and the remaining row count; documentation does not state whether case matters, so control that rule yourself with UPPER if it affects your result.

---

Remove Duplicates is one of the fastest commands in Excel: click a cell, go to Data → Remove Duplicates, tick some columns, click OK. Four seconds.

The trouble is that the same four seconds can produce two different answers on the same file, and the dialog never warns you when the answer is wrong. It reports "0 duplicates found" over a list that visibly contains repeats, or it quietly deletes the booking you needed because you ticked only one column.

This tutorial works through a small customer list, traps included. By the end you will know what Excel actually compares when it decides two rows are duplicates, how to preview the matches before anything is deleted, and how to fix the near-misses — a stray space, a number stored as text — that make real duplicates look different.

You need Excel for Microsoft 365, Excel 2021/2024, or Excel for the web; everything here is in the ribbon. If you are shaky on what a cell contains versus what it shows, read [the earlier article on cells, formulas and references](https://eulore.ai/articles/how-to-use-excel-5a9f3a0a) first.

## What Excel means by a duplicate

Three rules decide every result. All three are in Microsoft's documentation, and none of them is visible in the dialog itself.

**A duplicate is a row that matches another row in every column you tick.** Tick all columns and only rows that agree everywhere count as duplicates. Tick one column — Email, say — and two rows with the same email count as duplicates even when the names differ.

**The whole row goes with it.** Microsoft states that data is removed from all columns, even the ones you did not tick. So ticking Email does not "deduplicate the email column"; it deletes whole records based on the email. This is the most common way people lose rows they needed.

**Excel compares what the cells display, not what is stored.** Microsoft's own example: the same date formatted as `3/8/2006` in one cell and `Mar 8, 2006` in another counts as two unique values, because the text on screen differs. The same thing happens with a trailing space, where `"Delhi"` and `"Delhi "` are two different values, or with a text-formatted ID, where `00412` and `412` are two different values. Excel is not being inconsistent; it is comparing text, and those texts differ.

**It keeps the first one.** The first occurrence in the list survives; later copies are deleted. So row order is a decision you make, not an accident.

Microsoft's documentation does not say whether letter case affects the comparison, and reports differ. Don't build a result on that guess: if case matters for your data, decide the rule yourself with an `UPPER` helper column.

## Step 1: Type in the example list, then copy it

Enter this starting at `A1`. Row 4 is an exact copy of row 3; the last two rows are Eve twice, with a space stuck on the end of one address.

| | A | B | C |
|---|---|---|---|
| **1** | Name | Email | Class |
| **2** | Ada Chen | ada@example.com | Pottery |
| **3** | Ben Cho | ben@example.com | Pottery |
| **4** | Carla Diaz | carla@example.com | Yoga |
| **5** | Ben Cho | ben@example.com | Pottery |
| **6** | Ben Cho | ben@example.com | Painting |
| **7** | Dan Kim | dan@example.com | Pottery |
| **8** | Eve Park | eve@example.com␣ | Painting |
| **9** | Eve Park | eve@example.com | Painting |

For row 8, type the email then hit the space bar once before pressing Enter. That invisible space is the whole point.

Now copy the block: select `A1:C9`, press `Ctrl`+`C`, click `A12`, press `Ctrl`+`V`. Work only on the copy — Remove Duplicates deletes permanently, and `Ctrl`+`Z` only rescues you if you have not saved yet.

## Step 2: Decide which columns define one record

Click any single cell in the list and open **Data → Remove Duplicates** (keyboard: `Alt`, `A`, `M`). The dialog lists your columns with every box ticked, and `My data has headers` ticked, which keeps row 1 out of the comparison.

Ask what "one record" means here. For a mailing list it is one row per email address, so Email alone is the key. For a booking log, two rows with the same name and email but different classes are two bookings, and only a full-row match should be removed. A column that is unique on every row — a timestamp, a row ID — guarantees "0 duplicates found" if you leave it ticked.

![Remove Duplicates dialog with My data has headers checked and only the Email column ticked](https://cdn-7dee.kxcdn.com/wp-content/uploads/2026/10/remove-duplicates-dialog-columns.png)

For this first run, leave all three columns ticked and click OK.

## Step 3: Preview the matches before deleting anything

You should get the message **1 duplicate value found and removed; 7 unique values remain.** Row 5 is gone; everything else survived, including both Eve rows and Ben's Painting booking.

Click OK, then press `Ctrl`+`Z` to bring the list back. Deleting is fast; deciding which rows should go is slow, so keep the two apart.

Two ways to see the matches first:

**Conditional formatting, for one column.** Select `B1:B9`, then **Home → Conditional Formatting → Highlight Cells Rules → Duplicate Values**, and pick a fill colour. The three `ben@example.com` cells light up; the two Eve rows do not, because the space makes their text different. That silent gap is the pattern to watch: the highlight compares cells one at a time inside a column, so it previews repeated *values*, not duplicate *rows*.

**A helper column, for whole rows.** In `D1` type `Row check`, and in `D2`:

```
=COUNTIFS($A$2:$A$9,A2,$B$2:$B$9,B2,$C$2:$C$9,C2)
```

Fill it down to `D9` — [dragging the corner of D2](https://eulore.ai/articles/how-to-use-excel-5a9f3a0a) copies the formula and shifts its relative references, while the `$` locks the comparison ranges. You should see `2` in D3 and D5 and `1` everywhere else. Any count above 1 marks a row Remove Duplicates would delete, and the row that survives is the earlier one.

If column D says 1 everywhere, the list holds near-duplicates rather than duplicates — which is the next step. Delete the helper column before you carry on, so it does not join the comparison.

![Excel table with a COUNTIFS helper column showing 1 and 2 for each row's repeat count](https://arumsoft.com/assets/shots/en/excel/remove-duplicates.webp)

## Step 4: Fix the near-misses that hide real duplicates

Tick only Email and run the command. You should see **2 duplicate values found and removed; 6 unique values remain** — the exact-copy Ben row and the Painting Ben row, because both share Ben's email. Eve still appears twice, because of the space.

Undo both runs, then fix the space. In `E1` type `Clean email` and in `E2`:

```
=TRIM(B2)
```

Fill down to `E9`. `E8` now reads identically to `E9`. `TRIM` removes extra spaces except the single ones between words — but it only trims the ordinary space character, so a space pasted in from a web page or PDF may survive, because those are non-breaking spaces (character 160). If `TRIM` leaves a suspicious cell unchanged, use:

```
=TRIM(SUBSTITUTE(B2,CHAR(160)," "))
```

Put the cleaned text back where the original lived, since Remove Duplicates compares cells in place and a formula beside the data cleans nothing: copy `E2:E9`, click `B2`, then **Paste Special → Values**. Delete the helper column.

Two more near-misses behave the same way. Numbers stored as text are different values from numbers (`00412` versus `412`); convert with **Data → Text to Columns → Finish**. And the same date shown in two formats is two values, so apply one number format to the whole column before comparing.

Run the command again with Email ticked. This time: **3 duplicate values found and removed; 5 unique values remain.** Ada, one Ben, Carla, Dan and one Eve survive. The count changed because the space did.

## Step 5: Sort so the row you keep is the right one

Because the first occurrence survives, the row you want must come first. Ben's Painting booking is a real record that disappears the moment you dedupe on Email, so decide deliberately: sort by a "last updated" date, newest first, so the row worth keeping sits on top. Select the entire list before sorting, so the rows stay together.

## Step 6: Check the numbers against your preview

The dialog's "duplicates removed" should equal the number of helper-column rows that showed a count above 1, and "unique values remain" should equal your remaining row count. In the whole-row run that was one row with a `2` and one row removed. If the figures disagree, you compared different columns than you thought.

## If rows vanish that you meant to keep

- **You selected one column of a wider list.** Excel warns you and offers to expand the selection — choose expand. Continuing with just the column shifts cells upward and each record falls apart. Select the whole list, then tick the one column you want compared.
- **The header row got compared.** If `My data has headers` is unticked, the dialog shows "Column A" and treats row 1 as data.
- **Nothing is found, but you can see repeats.** Suspect a trailing space, a text-formatted number, or two date formats. Fix those, then try again.
- **The command refuses to run.** Remove Duplicates cannot process data with subtotals or an outline; clear those first.

The habit that makes this safe is the order of operations: copy the sheet, choose the key columns, preview with a helper column, clean the values that only *look* identical, sort for the row that should survive, and only then press the button. The four-second part is the last step, not the whole job.

## Mind map

```mermaid
flowchart LR
  A["Removing duplicate rows safely"] --> B["Know what Excel compares"]
  B --> B1["Only the ticked columns"]
  B --> B2["Keeps the first row, deletes the whole row"]
  B --> B3["Displayed text, not stored value"]
  A --> C["Preview before deleting"]
  C --> C1["Conditional formatting: repeated values in one column"]
  C --> C2["COUNTIFS helper column: whole-row repeats"]
  A --> D["Fix values that only look identical"]
  D --> D1["TRIM and CHAR(160) spaces"]
  D --> D2["Text number 00412 vs 412"]
  D --> D3["One number and date format"]
  A --> E["Sort to choose the surviving row"]
  A --> F["Check the result"]
  F --> F1["Helper counts = rows removed"]
  F --> F2["Remaining rows = unique values"]
```

## Glossary

- Duplicate key：The columns you tick in the Remove Duplicates dialog. Two rows are duplicates only if they match on all of them; unticked columns are not compared but are still deleted with the row.
- Keeps the first occurrence：Excel keeps the earliest row in sheet order and deletes later copies, so sorting is how you choose which row survives.
- Compares displayed values：Excel compares the text a cell shows, not the underlying stored value, so number formats, extra spaces and text-versus-number differences all make two rows unequal.
- COUNTIFS preview column：A helper formula that counts how often each row's values appear across the columns you plan to tick; anything above 1 marks a row the command would delete.
- TRIM and non-breaking spaces：TRIM strips extra spaces but only the ordinary space character (32); the non-breaking space (160) that arrives from web pages or PDFs needs SUBSTITUTE first.
- Paste Special → Values：Replaces the formula results with the plain text in the original column, because Remove Duplicates only compares the cells themselves, not a formula column beside them.

## Sources

1. [Find and remove duplicates — Microsoft Support (steps for highlighting duplicate values with conditional formatting, and how Remove Duplicates works)](https://support.microsoft.com/en-us/excel/find-and-remove-duplicates)
2. [Filter for unique values or remove duplicate values — Microsoft Support (what counts as a duplicate, a date example compared by displayed value, the first occurrence is kept, and data in unselected columns is deleted too)](https://support.microsoft.com/en-us/office/filter-for-unique-values-or-remove-duplicate-values-ccf664b0-81d6-449b-bbe1-8daaec1e83c2)
3. [TRIM function — Microsoft Support (TRIM only removes the ASCII space, character 32, not the non-breaking space, character 160)](https://support.microsoft.com/en-us/excel/functions/trim-function)

---

Original article: https://eulore.ai/articles/how-to-remove-duplicates-in-excel-cc3c9be2

> **Eulore** · Start small. Go deep.
>
> Eulore is an AI learning tool built around connected articles, each a 5–10 minute read. Ask questions as you go and help shape what comes next. That’s how this article was created.
>
> Start your own series → https://eulore.ai
