Duplicates

How to Remove Duplicates in Excel Without Losing Data

By the DecodingPro teamUpdated 6 min read

Quick answer

Decide what makes two rows "the same" (usually an email, an ID or name plus date of birth), clean those columns first so formatting differences do not hide matches, mark the duplicates with a helper column, review them, and only then delete. Use Data, Remove Duplicates for exact matches on the chosen columns, UNIQUE() in Microsoft 365 to produce a clean list without touching the source, and a review step for near-duplicates such as "Jon Smith" and "John Smith".

Removing duplicates sounds like a one-click job, and Excel does have a one-click button. The danger is that the button is fast, final and literal. It will remove a different person who shares a surname and city, and it will miss two records for the same person if one has a trailing space. This guide covers the safe procedure.

Three kinds of duplicate

KindExampleHow to find it
ExactTwo identical rowsRemove Duplicates, COUNTIF, UNIQUE
Hidden by formattingAnna@Mail.com and anna@mail.com Clean first (trim, lowercase), then use the exact methods
Partial or nearSame email, different name; "Jon Smith" and "John Smith" at the same addressMatch on a key column; review the rest

Most "Excel can't find my duplicates" complaints are the second kind. Fix the formatting problems before you search (see how to clean messy Excel data).

Step 1: Decide the key

The key is the column, or combination of columns, that identifies one real-world thing. Choose it before you click anything:

  • People: email address is usually the best key. A normalized phone number is next. Name alone is a poor key, because different people share names.
  • Products: SKU or barcode.
  • Orders and invoices: the order or invoice number.
  • Transactions: date plus amount plus reference together.
The classic mistake. Running Remove Duplicates on a single "Name" column keeps one row per name and silently deletes every other person called "Maria Garcia", along with all their data. Select the columns that together define identity.

Step 2: Normalize the key

Build a helper column that produces a comparable version of the key:

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

For a combination key, join the cleaned parts with a separator that cannot appear in the data, so that "ab"+"c" and "a"+"bc" do not collide:

=LOWER(TRIM(B2))&"|"&LOWER(TRIM(C2))&"|"&TEXT(D2,"yyyy-mm-dd")

Step 3: Mark before you delete

Never start by deleting. Add two helper columns next to your data:

Count:  =COUNTIF($F$2:$F$5000,F2)
Repeat: =IF(COUNTIF($F$2:F2,F2)>1,"duplicate","first")

Here F holds the normalized key. Count shows how many times each key occurs; Repeat labels the first occurrence "first" and later ones "duplicate" (the range $F$2:F2 grows as it is filled down). Filter for Count greater than 1 and read the groups. This is where you spot that two "duplicates" are actually different people, or that the second row holds a newer address worth keeping.

You can also highlight duplicates visually: select the column, then Home, Conditional Formatting, Highlight Cells Rules, Duplicate Values. This is fine for a quick look but does not tell you which row to keep.

Step 4: Decide which record to keep

  • Keep the newest. Sort by date descending (select the whole table first), then remove duplicates: Excel keeps the first occurrence it meets, which is the newest.
  • Keep the most complete. Add a helper that counts filled fields, =COUNTA(A2:H2), sort by it descending, then remove.
  • Merge, don't discard. If one row has the phone number and its twin has the address, copy the missing values across before deleting the twin.

Step 5: Remove

Method A: the Remove Duplicates button

  1. Click inside your data. Save a copy of the file first.
  2. Choose Data, Remove Duplicates (in the Data Tools group).
  3. Tick My data has headers if it does, then tick only the columns that form the key.
  4. Click OK. Excel reports how many duplicates were removed and how many unique values remain. Check those numbers against your Count column.

This button is not case-sensitive (Apple and apple count as the same) and it deletes in place, so it cannot be undone after you save and close.

Method B: UNIQUE (Microsoft 365), non-destructive

=UNIQUE(A2:H5000)

This spills a list of unique rows into a new area and leaves your source alone. Add a second argument to compare columns instead of rows, and a third (TRUE) to return only values that occur exactly once.

Method C: Power Query, repeatable

Load the table (Data, Get Data, From Table/Range), select the key columns, choose Remove Rows, Remove Duplicates, and load. Power Query's duplicate removal is case-sensitive, so lowercase the key first (Transform, Format, lowercase). Use it when the same clean-up has to be repeated on new data.

Want duplicates found, not silently deleted?

DecodingPro flags identical rows ("Identical to row 12") and repeated IDs ("Same email as row 7, other fields differ") with their row numbers, and never deletes them for you. Every change it does make is logged, and the finished file is compared with your original. 100 free credits to try it.

Clean a file free

Near-duplicates: Jon vs John

Exact methods cannot see that "Jon Smith, 12 Oak Street" and "John Smith, 12 Oak St" are the same person. There are three practical approaches:

  • Match on a stronger key. If both rows share the same normalized email or phone number, they are the same person whatever the name says. Use COUNTIF on that key alone.
  • Sort and eyeball groups. Sort by surname and postal code; near-duplicates land next to each other. Fine for hundreds of rows, hopeless for hundreds of thousands.
  • Clustering tools. OpenRefine's cluster and edit feature groups values that are probably the same using key-collision and nearest-neighbour methods and lets you merge them with a click. Power Query also offers fuzzy matching in merges.

All fuzzy methods produce candidates, not answers. "Jon" and "John" may be one person or two people in the same household. Treat a similarity score as a prompt to look, never as permission to delete.

Duplicates across two sheets or files

To see which rows of list A already exist in list B, add a helper column on A: =COUNTIF(ListB_key,F2)>0, or in Microsoft 365 =ISNUMBER(XMATCH(F2,ListB_key)). Rows returning TRUE already exist in B. This is the check to run before importing a new list into a CRM.

Pitfalls

  • Hidden or filtered rows. Clear filters before removing so you can see what you are deleting.
  • Displayed values. Microsoft documents that duplicates are judged by the value displayed in the cell, not the value stored: the same date formatted as 12/8/2017 and as Dec 8, 2017 counts as two different values. Format the key columns the same way first, or build a normalized text key. Formulas are compared by the value they display.
  • Merged cells. They break the operation. Unmerge before you start.
  • Different IDs for the same entity. Two customer IDs for one person means the problem is upstream. Flag it; do not just delete one.
  • Trusting the count. If you expected about 200 duplicates and 4,000 rows vanish, stop and undo.

Frequently asked questions

How do I remove duplicates in Excel but keep the first one?

Data, Remove Duplicates keeps the first occurrence it finds and deletes later ones. Sort first so that the row you want to keep (the newest, or the most complete) comes first.

Why does Excel not find my duplicates?

Usually because the values differ by invisible spaces, capitalization, non-breaking spaces or formatting (for example numbers stored as text in one row). Trim and normalize a helper key column first, then compare.

Is Excel's Remove Duplicates case-sensitive?

No. Apple and apple are treated as duplicates. Power Query's Remove Duplicates is case-sensitive by default.

How can I find duplicates without deleting them?

Use Conditional Formatting, Highlight Cells Rules, Duplicate Values, or a helper column with COUNTIF. In Microsoft 365, UNIQUE returns a deduplicated list without changing the source.

How do I find similar but not identical records?

Match on a stronger key such as email or phone, sort and review groups, or use a clustering tool like OpenRefine. Treat all fuzzy matches as suggestions to review.

Sources

  1. Microsoft: Find and remove duplicates
  2. Microsoft: Filter for or remove duplicate values (duplicates are judged by displayed value)
  3. Microsoft: UNIQUE function
  4. Microsoft: Working with duplicate values in Power Query
  5. OpenRefine: Clustering in depth

Keep reading

01Excel data cleaningHow to Clean Messy Excel Data: A Step-by-Step GuideThe fixed order that stops one fix from undoing another, with the formulas for every step.10 min read02Text and numbersHow to Keep Leading Zeros in Excel and CSV (ZIP Codes, IDs)Why Excel turns 02134 into 2134, how to get the zeros back, and how to stop it happening when you open a CSV.5 min read03CSV and importsHow to Clean a CSV File Before Importing It Into a CRMSeven fixes that prevent duplicate contacts, rejected rows and scrambled characters, and the 10-row test to run first.4 min read04DatesHow to Fix Dates in Excel and CSV Files (Mixed Formats)Text dates, day-month swaps, two-digit years and the one rule that makes dates safe to share.8 min read05Phone numbersHow to Fix Phone Numbers in Excel: Format and Country CodesLeading zeros, 9.19E+11, country codes and the international format that every system accepts.6 min read07DuplicatesHow to Find and Highlight Duplicates in ExcelFind repeats safely first: highlight them, count them, keep the first one, and spot the near-duplicates Excel does not see.3 min read08NamesHow to Standardize Names in Excel: Proper Case and ExceptionsWhat PROPER gets wrong, how to protect names that are already right, and how to flip "Smith, John" into "John Smith".4 min read09Email addressesHow to Fix Email Typos in Excel: gmial.com, .con and Missing @The typos that make campaigns bounce, and the formulas and checks that fix them without guessing.4 min read10Email addressesHow to Clean an Email List Before You Send a CampaignA five-step routine that removes the avoidable bounces from a list without deleting anyone you should keep.3 min read11NamesHow to Split Full Names into First and Last Name in ExcelFlash Fill, Text to Columns and formulas for splitting names, and the names that trip each one up.4 min read12Text cleanupHow to Remove Extra Spaces in Excel (TRIM, CLEAN and Non-Breaking Spaces)Why TRIM sometimes does nothing, and the one formula that removes every kind of stray space.3 min read13Text cleanupHow to Remove Special Characters and Line Breaks in ExcelThe characters you cannot see, the smart quotes you can, and the exact formula or shortcut that removes each one.4 min read14NumbersHow to Convert Text to Numbers in Excel (Numbers Stored as Text)Why sums show zero, why numbers sit on the left, and four ways to turn text back into real numbers.3 min read15Excel data cleaningHow to Clean Data with Power Query in Excel (Step by Step)Record your cleaning steps once and replay them on every new file, without formulas and without touching the original data.4 min read16Comparing dataHow to Compare Two Lists in Excel and Find What Is MissingFind the names, IDs or emails that are in one list and not the other, with formulas that scale.3 min read17CSV and importsFix Garbled Characters and Broken CSV Imports (UTF-8)UTF-8, delimiters, leading zeros, quotes and a checklist that makes a file safe to import.7 min read18Data entryData Entry Accuracy: How to Check, Measure and Improve ItWhat the research says about error rates, why proofreading fails and the checks that actually work.9 min read