Skip to content
ThinkQuarryIdeas for a smarter digital life. Contact

Office & Productivity

How to Remove Duplicates in Excel (6 Safe Methods)

Excel duplicate entries highlighted in a spreadsheet illustration

To remove duplicates in Excel, select the complete dataset, go to Data > Remove Duplicates, choose the columns that define a duplicate, and click OK. Excel keeps the first matching record and removes later matches from the selected range. Make a backup first because the operation deletes data.

Duplicate names, email addresses, invoice IDs, and product records can distort reports and cause confusion. But not every repeated value represents an error: two orders from the same customer may be legitimate. This guide explains six reliable ways to identify, review, and remove duplicate rows or values while keeping important information.

What Counts as a Duplicate in Excel?

Excel treats records as duplicates when their values match in every column you select in the Remove Duplicates dialog. Choosing the correct key matters more than choosing the fastest command.

NameEmailOrder ID
Johnjohn@example.com101
Sarahsarah@example.com102
Johnjohn@example.com103
Markmark@example.com104

The John rows share a name and email address, so they may be duplicates in a customer contact list. But they have different order IDs, so both may be valid in a sales order list. Decide whether your unique identifier is Email, Order ID, Product SKU, or a combination of fields before deleting anything.

Method 1: Remove Duplicate Rows With Excel’s Built-In Tool

The quickest method is the built-in Remove Duplicates command. It modifies the selected table rather than generating a separate report.

  1. Save a backup copy of the workbook.
  2. Click anywhere inside your complete dataset or select all columns that belong to each record.
  3. Open the Data tab and choose Remove Duplicates in Data Tools.
  4. Check My data has headers when the first row contains column headings.
  5. Select the columns Excel should compare. Click Unselect All first if needed.
  6. Click OK and read the confirmation showing the number of removed and remaining records.

For example, selecting Email as the only comparison column removes later rows with the same email address. Selecting Name and Email together removes only rows where both fields match.

Data-safety warning: Select the entire related table, not just one column, so names, email addresses, dates, and order IDs stay together. Otherwise, you may separate records from the details that belong to them.

Method 2: Remove Duplicates Based on One Column or Multiple Columns

Remove duplicate values based on one column

If you manage a contact list, Email may be your unique key. Select the whole table, open Data > Remove Duplicates, click Unselect All, select Email, and confirm. Excel keeps the first row for each email and removes the later matching rows from your selected range.

Compare more than one column

Sometimes an email is shared or a name is not unique. If a record should be considered a duplicate only when both Name and Email match, select both columns in the dialog. Excel then compares the combination of these values rather than each field independently.

Tip: A first name alone is rarely a reliable duplicate key. Prefer a unique ID, email address, invoice number, or carefully chosen combination of fields.

Method 3: Find and Highlight Duplicates Without Deleting Them

Before cleaning an important workbook, you can highlight repeated entries for manual review.

  1. Select the values you want to check.
  2. Go to Home > Conditional Formatting.
  3. Choose Highlight Cells Rules > Duplicate Values.
  4. Pick a formatting style and select OK.

Excel highlights repeated values without deleting them. You can then check whether a repeated entry is a genuine error, a legitimate second purchase, or a customer who appears in multiple projects.

To remove the highlighting later, open Home > Conditional Formatting > Clear Rules > Clear Rules from Selected Cells.

Limitation: This highlights repeated individual cell values. For a duplicate rule requiring two or more columns to match, use a COUNTIFS helper column instead.

Method 4: Get a Separate Duplicate-Free List With UNIQUE

Use the UNIQUE function when you want a cleaned list but do not want to alter the original dataset. It is supported in newer Excel versions such as Microsoft 365, Excel 2021 and later, and Excel for the web.

Return unique email addresses

If emails appear in cells B2:B100, enter this in an empty cell:

=UNIQUE(B2:B100)

Excel produces a separate list with one instance of each distinct email address.

Return unique combinations across a table

=UNIQUE(A2:D100)

Here Excel checks complete rows across columns A through D. If two records have different order IDs, they remain distinct even if their customer names match.

Important: Dynamic array results need empty adjacent cells. If you see #SPILL!, clear the obstruction or move the formula. Older Excel releases without UNIQUE can use Advanced Filter or the built-in Remove Duplicates command instead.

Method 5: Identify Repeat Entries With COUNTIF and COUNTIFS

Helper formulas can mark the second and later occurrences of an entry without modifying the source data.

Find repeated emails

Suppose addresses start in B2. Enter this formula in C2 and fill it down:

=COUNTIF($B$2:B2,B2)>1

FALSE marks the first occurrence; TRUE marks each later occurrence. You can filter for TRUE to review likely duplicate records.

Find duplicates based on both name and email

=COUNTIFS($A$2:A2,A2,$B$2:B2,B2)>1

This formula identifies later rows where both the name in column A and email in column B match an earlier row. Using both fields is useful when one value by itself is not unique enough.

Formulas are also helpful for audit trails because you can see which rows were flagged and why, rather than deleting records immediately.

Method 6: Remove Duplicates With Power Query

Power Query is useful when you import spreadsheets regularly or want to repeat the same cleaning process with new data.

  1. Select the source range and choose Data > From Table/Range.
  2. Confirm the table headers in the Power Query Editor.
  3. Select the column or columns that define a duplicate record.
  4. Choose Home > Remove Rows > Remove Duplicates.
  5. Review the result and choose Close & Load.

When the source changes, refresh the query to reapply the transformation. This makes Power Query suitable for recurring imports, supplier spreadsheets, and ongoing reporting workflows.

Does Power Query keep the first duplicate?

Do not assume Power Query will always retain the first row you see. Microsoft warns that the survivor is not necessarily guaranteed across transformations. If you must keep the newest transaction or highest-priority record, build an explicit rule using a date column, grouping, and a tie-breaker rather than relying on sort order alone.

Power Query comparisons are also case-sensitive, so standardize letter case first if uppercase and lowercase versions of an email should count as the same entry.

How to Remove Duplicates but Keep the Latest Record

If a contact database contains several updates for the same person, you may prefer the most recent entry.

  1. Save a backup and select the entire table.
  2. Sort the Last Updated column from newest to oldest.
  3. Go to Data > Remove Duplicates.
  4. Select the unique key, such as Email.
  5. Confirm the removal and review the kept records.

The standard Excel command retains the first matching entry, so sorting newest-first generally retains the latest row. When several records share the same timestamp, use a secondary sort key such as a unique record ID to make the ordering clear.

Never sort only the date column independently of the rest of the table. Doing so can mismatch customers, dates, and transactions.

How to Remove Duplicates in Excel Online

In Excel for the web, select the complete data range, go to Data > Remove Duplicates, pick your comparison columns, and confirm. For a shared workbook, consider making a copy before deletion because other collaborators may depend on the original rows.

Why Is Excel Not Removing Some Duplicates?

Extra spaces

Imported entries can have leading or trailing spaces. Use =TRIM(B2) in a helper column to normalize ordinary spaces before comparing data.

Hidden characters

Line breaks and nonprinting characters may make strings look identical when they are not. Try =CLEAN(B2), and inspect unusual spaces such as nonbreaking spaces separately.

Incorrect comparison columns

If you select every column, differences in dates, timestamps, or order IDs can prevent otherwise similar records from matching. Choose only the fields that define a duplicate for the current task.

Only part of the table selected

Convert the range into an Excel Table and ensure all related columns are included, particularly when working with filtered or imported data.

How to Undo Removed Duplicates

If you removed the wrong records, immediately try Ctrl+Z on Windows or Command+Z on Mac. If Undo is unavailable, restore a backup. For workbooks stored on OneDrive or SharePoint, check Version History for a prior copy.

For more spreadsheet troubleshooting, see why Excel formulas aren’t calculating and our guide to calculating percentage increases in Excel.

Which Duplicate Removal Method Should You Use?

MethodBest useDeletes original data?
Remove DuplicatesOne-time cleanupYes
Conditional FormattingReviewing suspicious repeatsNo
UNIQUECreating a separate distinct listNo
COUNTIF / COUNTIFSAuditing repeated recordsNo
Power QueryRepeatable data transformationsNo; usually loads a transformed output
Sort + Remove DuplicatesKeeping the latest entry in normal Excel tablesYes

Frequently Asked Questions

Does Excel remove all duplicates or keep one?

Excel’s built-in Remove Duplicates tool retains the first matching occurrence in the selected data and removes subsequent matching rows.

Can I remove duplicates from only one column?

Yes. Select the full dataset but check only the column used to identify duplicates. Matching records are removed from the selected table, keeping row data aligned.

How do I find duplicates without deleting them?

Use Conditional Formatting to highlight repeated values, or a COUNTIF/COUNTIFS helper formula to flag matching records.

How can I remove duplicates without losing the original data?

Use UNIQUE to create a new list, perform the cleanup on a copied worksheet, or use Power Query to load a transformed output.

How do I keep the newest record?

Sort the full table newest-first and use the built-in Remove Duplicates feature on a reliable unique key. Add a tie-breaker if timestamps match.

Why does Excel say no duplicates were found?

Your selected columns may differ, or the cells may contain invisible spaces, different data types, or hidden characters. Review the key fields and normalize them.

Is Power Query better than Remove Duplicates?

Power Query is better for repeatable data cleanup; Remove Duplicates is quicker for a small, one-time task. Choose based on whether you need a reusable workflow.

Final Thoughts

Use Data > Remove Duplicates for the fastest cleanup, but confirm which columns define a genuine repeat. If accuracy matters more than speed, begin with Conditional Formatting or a helper formula, and use UNIQUE or Power Query to keep the original information intact.

Official references: Microsoft Support: duplicate values; Microsoft Learn: Power Query duplicates.

About ThinkQuarry

Practical explanations and useful frameworks for your digital life.

Our editorial standards ↗