How to Remove Duplicates in Excel Without Losing Data in 2027

How to Remove Duplicates in Excel

Duplicate records can make a spreadsheet look more complete than it really is. A customer may appear twice in a mailing list, an invoice may be imported repeatedly, or a product catalogue may contain several copies of the same item. These errors can inflate totals, distort reports and create unnecessary work. However, deleting every repeated value is not the answer. A customer can legitimately place several orders, and two employees can have the same name.

The safest way to remove duplicates in Excel is to preserve the original worksheet, identify the columns that define a duplicate, review matching records and create a clean result. Excel offers both destructive and non-destructive approaches, so you can choose a method that fits the purpose of your spreadsheet. This tutorial explains how to use built-in commands, formulas and Power Query, with examples that show what to keep and what to remove. The instructions primarily use desktop Excel for Windows; availability and ribbon labels can differ on Mac and the web.

Know More: How AI Is Changing Software Developer Jobs: 9 Powerful Trendsxx

1. How to Remove Duplicates in Excel: Understand what counts as a duplicate

A duplicate is not necessarily an entire row that looks identical. In a contact database, the email address might be the identifier, while a sales database might require an order number and product code together. The definition depends on the level of detail represented by each row. Decide whether the worksheet describes customers, transactions, products or individual events before selecting a comparison column.

Imagine a sheet containing a customer ID, customer name, order number and amount. Customer C101 appears three times because the customer placed three orders. Removing duplicates using customer ID would leave only one order, which would understate revenue. If the sheet is intended to list customers rather than orders, a separate unique customer list may be appropriate. The transaction sheet should remain intact.

There are also exact duplicates, conflicting duplicates and apparent duplicates. Exact duplicates repeat all relevant fields. Conflicting duplicates share an identifier but have different details, such as a new telephone number. Apparent duplicates look similar but represent different entities. A name such as Rahul Sharma is not a reliable unique identifier. For conflicting records, decide which source is authoritative or combine verified information manually. No automatic deletion command can make that business decision for you.

2. Prepare a safe working copy

Open the workbook and save a separate copy with a descriptive name, such as Sales_Cleanup_2026_12_05.xlsx. Alternatively, duplicate the relevant worksheet and rename the tabs Raw Data and Working Data. Keep the raw sheet unchanged. If the workbook is shared, coordinate with other editors so that changes made during cleanup are not accidentally overwritten.

Check that the data has one header row and that every column has a clear name. Remove decorative blank rows from the working copy if they interrupt the data range. Unmerge cells where appropriate, but first preserve any labels that apply to multiple records. Make sure dates, identifiers and monetary values use consistent data types. Identifiers containing leading zeros should normally remain text rather than being converted into numbers.

Record the initial number of data rows and any meaningful totals. For example, a sales sheet may have 2,400 records and a total invoice value of 850,000. These figures provide a baseline for later reconciliation. Add a source row identifier if there is no existing record ID. A stable identifier helps trace a cleaned record back to the original export. If formulas refer to other sheets, preserve the entire workbook rather than copying only the visible values without checking dependencies.

Convert the working range into an Excel table using Ctrl+T if appropriate. Confirm that the table includes the headers and every relevant column. Tables make it easier to filter records and extend formulas when new rows are added. Do not include unrelated notes or totals in the data range. The objective is to create a rectangular dataset that can be checked consistently.

3. Highlight duplicates before deleting anything

Conditional Formatting is a useful first inspection tool because it changes appearance rather than removing information. Select the identifier cells, excluding the header. On the Home ribbon, open Conditional Formatting, choose Highlight Cells Rules, then Duplicate Values. Pick a visible formatting style and confirm. Repeated entries should now stand out in the selected range.

Review the highlighted records alongside their other fields. If you are checking email addresses, compare the names, customer IDs and update dates for each highlighted group. A repeated email may belong to a shared business mailbox rather than one individual. If the sheet contains a product code, compare the warehouse or branch column before deciding whether a repeated code is incorrect.

The built-in rule highlights repeated cell values, not necessarily duplicate rows. Selecting several columns at once can highlight a common city or price even though the corresponding records are different. To check combinations of fields, use a helper formula instead. Also remember that highlighting both the first and subsequent occurrences is useful for review but does not identify which one should survive.

You can filter by cell colour to inspect flagged records together. Clear the filter when you finish and retain the formatting if it helps future review. If you want to remove the rule, use the Conditional Formatting rules manager. Removing a formatting rule does not delete the underlying values. This method is particularly useful when a colleague needs to approve changes before any records are removed.

4. Use Remove Duplicates for confirmed repeated records

The built-in removal command is convenient when the duplicate definition is already established. Work on the copied worksheet. Select the complete data table, open the Data ribbon and choose Remove Duplicates. Confirm that Excel has correctly identified the header row. In the column selection dialog, select the fields that together define a duplicate. For a fully repeated export, selecting every relevant data column may be suitable.

For a customer master list, selecting only Customer ID may be sufficient if each customer should have exactly one row. However, the unchecked fields are not protected: Excel can remove the entire matching record from the selected range, including values in columns that were not selected as comparison keys. This is why the choice of key is more important than the number of clicks required to complete the operation.

Before confirming, decide which record should remain. The command retains the first matching occurrence in the current list. If the most recent verified customer record should survive, sort the complete table by the appropriate update date from newest to oldest before removing duplicates. Add a secondary sort field if dates are tied. Never sort only one column independently of its associated records, because that can separate values that belong together.

After confirming the operation, note the reported number of removed and remaining records. Compare those figures with your baseline. If you expected ten repeated rows but Excel removed hundreds, undo immediately and investigate the selected columns. Save the cleaned version under a separate name only after reviewing the result. Undo is useful during the current editing session, but a preserved original is more dependable after closing the workbook.

5. Extract unique records without modifying the source

Advanced Filter is a good choice when you need a static clean list and want to retain the original. On a desktop version that supports the feature, select the source range with its header. Open Data and choose Advanced in the sorting and filtering area. Choose the option to copy the results elsewhere, verify the list range, select an empty destination and enable the unique records option. Confirm to create the extracted list.

For example, a sheet may contain a list of suppliers in column A, with several repeated names. You can extract distinct names into an empty area of the same worksheet. If the source has multiple columns, the selected record fields determine the distinct combinations. To obtain only supplier names, use the supplier column rather than including every transaction detail. Make sure the output area is large enough and does not overlap existing information.

The extracted results are a snapshot. If a supplier is added tomorrow, the output will not automatically update just because the source changed. Repeat the filter or use a dynamic formula if the list must stay current. The alternative in-place filter hides repeated records rather than deleting them. Clear the filter to restore the full view. These options are useful for preparing reports while maintaining a complete audit trail.

6. Find duplicates using COUNTIF and COUNTIFS formulas

A helper column gives you more control over which records are marked. Suppose column A contains customer IDs in rows 2 through 100. Enter the following formula in B2 and fill it down to flag every nonblank ID that appears more than once.

=IF(A2=””,””,IF(COUNTIF($A$2:$A$100,A2)>1,”Review”,”Unique”))

The fixed range remains unchanged as the formula is copied, while the reference to A2 changes for each row. This makes the formula evaluate the current ID against the entire list. All occurrences of a repeated ID receive the Review label. You can filter the helper column to inspect the complete group before deciding which record to keep.

To mark only the second and later appearances, use an expanding range instead. The first endpoint stays fixed while the second endpoint follows the current row.

=IF(A2=””,””,IF(COUNTIF($A$2:A2,A2)>1,”Later occurrence”,”First occurrence”))

This approach is helpful when the first record is the approved version. If a later record is more accurate, change the sorting or review policy first. The formula identifies order of appearance, not correctness. COUNTIF is generally case insensitive and interprets certain characters as wildcards, so identifiers containing literal asterisks or question marks require additional care.

When an order number alone is insufficient, use COUNTIFS to compare several fields. Suppose column A contains order IDs and column B contains product codes. Enter this formula in an unused column to flag subsequent occurrences of the same combination.

=IF(OR(A2=””,B2=””),”Review missing key”,IF(COUNTIFS($A$2:A2,A2,$B$2:B2,B2)>1,”Review duplicate”,”First”))

An order with two different products will not be flagged merely because the order number repeats. However, if the same product can legitimately appear twice on separate order lines, include a line number as another criterion. Adapt the key to the real structure of the dataset. Filter the results and review flagged rows rather than immediately deleting everything labelled Review.

7. Create a dynamic unique list with UNIQUE

In supported modern Excel versions, including Microsoft 365 and Excel 2021 or later, UNIQUE can produce a distinct list without changing the source. Enter the formula below in an empty cell outside the original table.

=UNIQUE(A2:A100)

The result spills into neighbouring cells. If there is existing content blocking the output, Excel may display a spill error. Move the formula or clear only the cells that are safe to clear. The original values remain available for inspection, and the result recalculates when the referenced values change.

For a list that excludes empty entries, combine UNIQUE with FILTER. The third argument of FILTER provides a message when there are no matching values.

=UNIQUE(FILTER(A2:A100,A2:A100<>””,”No records”))

You can also use UNIQUE on a range containing several columns to return distinct combinations of values. For example, =UNIQUE(A2:C100) compares the rows across all three columns. This does not automatically select the latest record for each customer ID when the other fields differ. Use a separate rule to choose the preferred record in that situation.

A useful distinction is the exactly_once argument. Setting it to TRUE returns entries that occur only once, excluding every member of a repeated group. That is different from retaining one copy of each repeated value. If your objective is a normal deduplicated list, leave that argument omitted or set it to FALSE. Older Excel releases without dynamic arrays can use Advanced Filter or helper columns instead.

8. Clean inconsistent text before comparison

Imported data often contains invisible spaces, inconsistent capitalization or nonprinting characters. Two email addresses may look identical on screen but differ because one has an extra space at the end. Create a separate normalized key column rather than replacing the original text immediately. For ordinary email matching where case is not significant for your workflow, the following formula is a practical starting point.

=LOWER(TRIM(CLEAN(SUBSTITUTE(A2,CHAR(160),” “))))

SUBSTITUTE replaces common nonbreaking spaces, CLEAN removes certain nonprinting characters, TRIM handles ordinary extra spaces, and LOWER converts letters to lowercase. This does not remove every possible Unicode whitespace character. Review unusual imported values separately. Keep the original email column so you can see what was changed and avoid applying the same transformation blindly to case-sensitive codes.

Phone numbers and postal codes need different rules. Removing punctuation from telephone numbers can help comparison, but country codes and extensions may carry important meaning. Converting postal codes to numbers can discard leading zeros. Dates imported as text should be interpreted using the correct regional format before comparison. A date such as 05/12/2026 can have different meanings in different locales. Normalization should improve consistency without changing the meaning of a record.

9. Automate recurring cleanup with Power Query

If you receive a new export every week, repeating manual cleanup can introduce inconsistencies. Power Query lets you define a repeatable transformation and load a separate output. In a supported desktop Excel version, select the source table and use Data > From Table/Range to open the editor. Confirm the column types, especially for IDs, dates and amounts. Apply any approved text cleaning steps before comparing records.

Select the columns that define duplicates, then use the editor’s Remove Rows menu to remove duplicate records. Alternatively, keep duplicate rows in a separate review query to investigate conflicting information. Power Query text comparisons are case sensitive, so normalize case deliberately when your business rules require case-insensitive matching. Load the cleaned query into a new worksheet and keep the source table unchanged.

Do not assume that sorting a query before removing duplicates guarantees which matching record survives. Query optimization can affect the retained row. If the latest record must survive, group records by their key and explicitly select the maximum valid update timestamp, using a stable tie-breaking identifier where needed. Review tied or missing timestamps rather than silently choosing a record. This is especially important for customer profiles, inventory snapshots and financial data.

When a new export arrives, replace or extend the source according to the query design and refresh the output. Check for changed column names, new data types and unexpected row counts. A refreshable process is useful only when its assumptions remain valid. Document the selected key and retention policy so that another employee can maintain the workbook without guessing.

10. Practical examples and final validation

Consider a mailing list with five records: Asha, Ravi, Asha, Neha and Ravi, each with the same email as their matching name. A unique email list should contain three addresses. If Ravi has two different email addresses, the output may legitimately contain four addresses instead. The expected result depends on whether the report represents people or email destinations. Review consent and contact preferences before combining mailing records.

For a sales export, imagine invoice I101 contains two product lines worth 500 and 700, while invoice I102 contains a line worth 300. A repeated import adds another copy of the 700 line. The raw total becomes 2,200. Removing only the confirmed repeated line returns the correct total of 1,500. Removing duplicates by invoice number alone could incorrectly discard a valid product line. Use invoice and line identifiers together, and reconcile the final total with the accounting source.

For a customer master database, suppose customer C204 has an older address and a verified new address. Keeping the newest record may be sensible, but the older record could contain a telephone number missing from the new one. Review conflicting fields before choosing a surviving row. If necessary, create a consolidated record and retain both original records in an archive. Deduplication is not the same as merging information.

After cleanup, compare the number of rows, distinct identifiers and relevant totals with the original. Check a sample of retained records and every high-value exception. Verify that formulas, charts and PivotTables still refer to the intended range, and refresh reports when required. Keep a short log describing the original file, the comparison columns, the removal count and the person who approved the changes. This makes the process reproducible and reduces the risk of unexplained differences later.

The best Excel duplicate removal method is the one that preserves the meaning of the dataset. Use highlighting and formulas for investigation, a separate unique list for reporting, and direct deletion only for confirmed redundant records. For recurring exports, a documented query can save time while keeping the original source available. A clean spreadsheet should be accurate, traceable and useful, not simply shorter.

Method comparison

Method

Source changed?

Best use

Conditional formatting

No

Visual review

Remove Duplicates

Yes

Confirmed redundant rows

Advanced Filter

No, if copied

Static distinct list

COUNTIF / COUNTIFS

No

Review flags

UNIQUE

No

Dynamic output

Power Query

No, with separate output

Recurring imports

 

Example: selecting the correct comparison key

Dataset

Suggested key

Avoid

Customer master

Customer ID

Name alone

Invoice lines

Invoice ID + line ID

Invoice ID alone

Inventory

SKU + warehouse

SKU alone

Mailing list

Approved normalized email

Name alone

 

”FAQs”

1. Can I remove duplicates without deleting original data?

Yes. Use UNIQUE or copy the Advanced Filter result to an empty destination.

2. Does Remove Duplicates keep the first row?

Yes, in the current list order. Sort the complete range first if a particular row must survive.

3. Can I undo duplicate removal?

Usually during the current editing session. Keep a separate backup for reliable recovery.

4. How do I find duplicates without removing them?

Apply the Duplicate Values conditional formatting rule or use a COUNTIF helper column.

5. How do I compare two columns together?

Use COUNTIFS for a combined key, or select both columns in the removal dialog.