Tutorial

How to Remove Duplicates in Excel: Built-in Tools, UNIQUE, and Fixes

Learn how to remove duplicates in excel using the Data tab tool, UNIQUE formula, and Advanced Filter. Step-by-step methods, edge cases, and analyst fixes.

Anuj SainiSep 8, 20269 min read

Knowing how to remove duplicates in excel is one of the most critical hygiene steps in any analytics workflow. When CRM leads export twice, transaction logs register network retries, or regional inventory sheets merge together, duplicate records artificially inflate metrics, skew conversion rates, and undermine executive trust. Clean deduplication is the dividing line between an amateur spreadsheet and an audit-ready dataset.

In this comprehensive tutorial, we cover the standard built-in button, dynamic array formulas, advanced filters, and edge cases that cause Excel to silently miss identical rows. If you are preparing your data for deeper analysis, this guide connects directly with our data cleaning in Excel guide and pairs with our XLOOKUP tutorial for cross-referencing deduplicated keys.

On the Data Analyst Roadmap, mastering deduplication sits inside week 2 of core spreadsheet fluency: the exact same distinct filtering logic you apply here in Excel will later appear as SELECT DISTINCT and ROW_NUMBER() deduplication in SQL.


Monthly searches for deduplicating records in Excel

Data analysts spend up to 40% of their reporting preparation time cleaning duplicate entries, resolving merge conflicts, and formatting text before building dashboard models.


How to Remove Duplicates in Excel: The Built-in Tool

The primary method for in-place deduplication is the native Remove Duplicates feature on the Data ribbon. It deletes redundant rows directly from your selected table or range. Before removing duplicates permanently, analysts frequently audit records by comparing two columns in Excel to identify matches and orphaned keys.

excel
Ribbon: Data > Data Tools > Remove Duplicates
Shortcut (Windows): Alt + A + M
Shortcut (Mac): Option + A + M
SettingSelectionPurpose
My data has headersCheckedPrevents Excel from evaluating your column titles as data rows
Select AllAll ColumnsDeletes rows only when every single column matches
Unselect AllSpecific Key (e.g., Email or User ID)Deletes rows where the chosen primary key repeats, ignoring differing timestamps

Step-by-Step Walkthrough: Deduplicating Customer Orders

Consider a raw e-commerce export in columns A through D containing duplicate order events caused by payment webhook retries:

Order IDCustomer NameOrder AmountStatus
1081Priya Sharma2400Completed
1082Rohan Gupta1500Completed
1081Priya Sharma2400Completed
1083Amit Verma4200Pending
1082Rohan Gupta1500Completed

To clean this table:

  1. Highlight the range: Select cells A1:D6.
  2. Launch the tool: Press Alt + A + M or click Data > Remove Duplicates.
  3. Verify headers: Ensure My data has headers is checked so row 1 (Order ID, Customer Name, etc.) is protected.
  4. Choose column criteria:
    • If you check all four columns, Excel only deletes rows where every field matches.
    • If you check only Order ID, Excel keeps the first instance of Order 1081 and immediately deletes any subsequent row with Order ID 1081, even if the other columns differ.
  5. Execute: Click OK. Excel presents an alert message: "2 duplicate values found and removed; 3 unique values remain."

Data Loss Risk: Always Work on a Copy

The Data ribbon's Remove Duplicates tool permanently modifies your sheet. If you mistakenly select the wrong key column, Excel purges valid records, and Ctrl + Z undo history can be cleared if the workbook recalculates or saves. Always duplicate your sheet or backup the column before running in-place deletion.


Method 2: Dynamic Deduplication with the UNIQUE Formula

For automated, non-destructive workflows, modern versions of Excel (Microsoft 365, Office 2021, and Excel for the Web) provide the =UNIQUE() dynamic array function. Instead of deleting data, it extracts unique records to a new location.

UNIQUE Function Syntax

excel
=UNIQUE(array, [by_col], [exactly_once])
ArgumentRequiredDescription
arrayYesThe source range or table (e.g., A2:D100)
[by_col]NoFALSE (or omitted) compares rows; TRUE compares columns
[exactly_once]NoFALSE (or omitted) returns all distinct values; TRUE returns only rows that occur exactly once

Formula Examples

Extract all distinct customer orders into cell F2:

excel
=UNIQUE(A2:D6)

The formula spills downward and across, generating an exact copy with duplicates filtered out. If a new row is appended to A2:D6, the formula output updates automatically without any manual ribbon clicks.

To extract only customers who have ordered exactly once (filtering out any repeat buyers):

excel
=UNIQUE(A2:D6, FALSE, TRUE)

Pairing =UNIQUE() with the FILTER formula in Excel allows you to extract unique records filtered by status:

excel
=UNIQUE(FILTER(A2:D6, D2:D6="Completed"))

Method 3: Highlighting Duplicates Before Deleting

Senior analysts never delete records blindly. Visualizing duplicates first prevents catastrophic deletions caused by customer name collisions (e.g., two different customers named "Rahul Sharma").

  1. Select your target column (e.g., B2:B100).
  2. Go to Home > Conditional Formatting > Highlight Cells Rules > Duplicate Values.
  3. Choose the alert formatting (e.g., Light Red Fill with Dark Red Text).
  4. Click OK.

Review the highlighted cells. If you spot identical names, inspect adjacent columns like Email, Phone Number, or Customer ID to verify whether they represent the same individual or distinct accounts. For deeper formatting rules, consult our conditional formatting in Excel guide.


How to Remove Duplicates in Excel: Advanced Dynamic Array and Power Query Methods

While the ribbon tool modifies your raw cells in place, senior analysts frequently need non-destructive workflows where the original extract remains untouched while a clean, deduplicated table is generated downstream. Explore more techniques in our Excel Tutorials hub.

Method 4: Automated Deduplication via Power Query for Recurring Data Feeds

When you receive automated weekly or monthly CSV extracts that suffer from repeating records, manual ribbon clicking becomes a repetitive liability. Power Query automates deduplication into a repeatable, single-click refresh pipeline:

  1. Select your raw dataset and go to Data > From Sheet / From Table/Range.
  2. Inside the Power Query Editor, select the key columns that determine uniqueness (hold Ctrl to select multiple columns like CustomerID and TransactionDate).
  3. Right-click the selected column header and choose Remove Duplicates (or click Home > Remove Rows > Remove Duplicates).
  4. Click Close & Load to output the pristine data into a new worksheet.
  5. Whenever new raw rows are pasted into the source table, navigate to Data > Refresh All to automatically deduplicate the dataset in sub-second time.

Defensive Pre-Cleaning: Trailing Spaces and Invisible Characters

The most common reason the Remove Duplicates dialog misses repeating rows is trailing whitespace, leading spaces, or invisible non-breaking spaces (CHAR(160)) introduced during database exports:

excel
=TRIM(CLEAN(A2))

Run =TRIM(CLEAN(cell)) in an adjacent helper column before deduplication. TRIM strips redundant ASCII spaces, while CLEAN strips non-printable control characters, ensuring that "Acme Corp " and "Acme Corp" match identically during the deduplication scan.

Common Mistakes When Removing Duplicates in Excel

Even experienced operators encounter situations where Excel claims "0 duplicate values found" when visual duplicates are clearly present. Here are the three primary causes:

1. Hidden Trailing and Leading Spaces

Web portals and database exports frequently append invisible trailing whitespace. To Excel, "Rohan Gupta" and "Rohan Gupta " are two completely different strings.

The Fix: Create a helper column with the TRIM and CLEAN functions before deduplicating:

excel
=TRIM(CLEAN(B2))

Copy the helper column, paste as values over the original, and rerun Remove Duplicates.

2. Case Sensitivity Mismatches

The built-in Data > Remove Duplicates dialog is case-insensitive (it treats "DELHI" and "delhi" as identical). However, certain lookup formulas and external Python scripts are case-sensitive. If you need case-sensitive deduplication in Excel, generate a hash helper column using EXACT:

excel
=SUMPRODUCT(--EXACT(B2, $B$2:$B$100))

3. Number Stored as Text vs Real Numbers

If Order ID 1081 in row 2 is formatted as a number, but row 4 contains '1081 formatted as text, Excel treats them as distinct values. Convert text-numbers to true numeric format by selecting the column, opening Data > Text to Columns, and clicking Finish.


Tool Comparison: When to Use Each Method

Feature / Criteria

Real-World Analyst Workflow: Deduplicating Leads

In marketing analytics, deduplicating campaign signups requires business logic beyond simple row matching. Suppose marketing receives 5,000 webinar registrations across LinkedIn, Google Ads, and Email blasts. A user may register twice with different UTM parameters.

  1. Define the Business Key: Deduplicate on Email Address rather than the entire row. The email identifies the human lead.
  2. Sort by Priority: Before running deduplication, sort by Registration Date descending so that the lead's most recent interaction or attribution channel is preserved in the first row.
  3. Execute Deduplication: Uncheck all columns except Email.
  4. Audit: Validate the row count using =COUNTA(A2:A5000) against the original count to measure lead inflation.

Once your dataset is clean and unique, compute summary metrics using the SUM formula in Excel and link records using INDEX MATCH in Excel.


Master Excel for Data Analytics

Build clean, production-grade spreadsheets and master analyst formulas with our interactive, project-driven course.

Start Free Excel Course

Frequently Asked Questions

How to remove duplicates in Excel without losing original data?

To preserve your original data while removing duplicates, use the dynamic formula =UNIQUE(A2:C100) in a new range or worksheet. Alternatively, copy your source table to a backup column before clicking Data > Remove Duplicates.

What is the shortcut key to remove duplicates in Excel?

In Excel for Windows, select your data range and press Alt, then A, then M sequentially (Alt + A + M). This opens the Remove Duplicates dialog box instantly.

Why does Excel Remove Duplicates miss identical rows?

Excel often misses duplicates due to invisible trailing spaces, non-breaking spaces (ASCII 160 from web exports), or inconsistent text casing. Cleaning cells with =TRIM(CLEAN(A2)) before deduplication resolves the mismatch.

What is the difference between Data > Remove Duplicates and the UNIQUE function?

Data > Remove Duplicates permanently deletes duplicate rows from the selected range in place. The =UNIQUE() function creates a dynamic, spill-range copy leaving the original data untouched and auto-updating when new rows arrive.

How do you highlight duplicates before deleting them in Excel?

Select the range, navigate to Home > Conditional Formatting > Highlight Cells Rules > Duplicate Values. Choose a highlight color and click OK to inspect flagged duplicates before taking destructive action.

Anuj Saini

Written by

Anuj SainiFounder & Lead Instructor

Founder at Topfolio with 6+ years in data & analytics across JPMC, Ultrahuman, and high-growth startups. Sat on hiring panels, reviewed 500+ resumes, and writes practical SQL & data guides.