U
Useful by Friday
The Monday Test

How to remove duplicate rows in excel without losing the wrong data

How to remove duplicate rows in excel without losing the wrong data
Learn how to remove duplicate rows in excel, choose the right matching columns, preserve your original data, and check the results before sharing.

The quickest answer to how to remove duplicate rows in excel is to select your entire dataset, open Data > Remove Duplicates, and choose the columns that define a match. Excel keeps the first matching row and removes the others. Before you click OK, save a copy: the right columns and the order of your rows determine which information survives.

Start with a copy and a clear definition

Save a separate copy of the workbook, or duplicate the worksheet by right-clicking its tab, choosing Move or Copy, and selecting Create a copy. A copy gives you something to compare against if the results aren't what you expected. If you're working in a shared file, make sure your cleanup won't disrupt someone else's work.

Next, decide what a duplicate means for this particular job. If every field must match, compare every column. If you want one row per customer, an account ID might be the relevant key. But two rows with the same account ID can contain different phone numbers, order dates, or notes. Removing one of them throws away that other information too.

For example, imagine two rows with account ID 104: one has an older contact name, and the other has a newer one. Matching on account ID alone leaves only one row. If both contacts matter, these aren't duplicates for your purpose.

Check that each column has a header and that the data is arranged as one continuous block. Blank columns or rows can make it harder to select the whole dataset. You want Excel to remove complete records, not just cells in one column and leave the remaining fields misaligned.

how to remove duplicate rows in excel using the Data tab

Select a cell inside the dataset, then select the entire range, including headers. You can also click and drag over the full range. Look at the selection before proceeding: every column that belongs to each record should be included, even if only one column will determine the match.

Illustration for how to remove duplicate rows in excel

On the Data tab, choose Remove Duplicates. In the dialog, check My data has headers if your first selected row contains column names. Then select the columns Excel should compare. The column checkboxes control the matching rule; they do not limit which parts of a duplicate record are removed.

For exact duplicate records, select all columns. For one row per account ID, select only the account ID column. Click OK. Excel reports how many duplicate values it removed and how many unique values remain. Compare that message with your expectations and inspect a few affected records.

If the outcome is wrong, try Undo immediately, then adjust the matching columns or restore your saved copy. Don't rely on Undo as your only backup, particularly after closing the file or making more edits.

Choose which row survives

Remove Duplicates keeps the first occurrence in the selected range. That makes sorting part of the cleanup, not an afterthought. If you want the most recent record for each account, sort the entire dataset by the relevant date from newest to oldest before removing duplicates by account ID. Excel will then encounter the newest dated record first for each account.

Make sure the date column contains real Excel dates rather than text that merely looks like a date. A sort that puts entries in an unexpected order is a warning to stop and fix the date values first. Also decide how to handle ties: two records with the same account ID and date may still disagree in other fields. Review those records or apply another meaningful sort before removing anything.

If your goal is to combine details from multiple records, don't use Remove Duplicates as a substitute for merging. It keeps one complete row; it doesn't gather the best phone number, address, and notes from all matching rows. Review or consolidate those fields before discarding records.

Preview matches before deleting

A helper column lets you flag repeated keys while keeping every row visible. If account IDs are in column A, with headers in row 1 and data starting in row 2, enter this formula in an empty column on row 2:

=COUNTIF($A$2:A2,A2)

Fill it down through the dataset. The first occurrence of an ID gets 1; later occurrences get 2, 3, and so on. Filter the helper column for values greater than 1 to inspect the later occurrences. Filter the original ID column as needed to see their first occurrences alongside them.

Visual context for how to remove duplicate rows in excel

This formula checks only column A. It flags repeated IDs, not necessarily identical records. If blank IDs are possible, inspect them separately: multiple blank cells can be counted as repeats even though you may not know whether they belong to the same account.

You can also use Home > Conditional Formatting > Highlight Cells Rules > Duplicate Values to highlight repeated values in a selected column. That's a visual check, not a full-row comparison or a deletion. It can help you spot records worth investigating before choosing a rule.

Use a formula when you need a separate result

In Excel versions that support dynamic arrays, UNIQUE can return distinct rows without changing the original range. For a dataset in A2:D100, enter the following in an empty area with enough clear space for the result:

=UNIQUE(A2:D100)

This compares the columns in that range and returns one copy of each distinct row. The output changes when the source values change, but a fixed reference such as A2:D100 does not automatically include new rows added beyond row 100. Use an appropriate range or an Excel table reference if the source will grow.

The result needs room to spill into neighboring cells. If Excel shows a spill error, check for content blocking the output area. Also remember that a distinct full row is different from one row per customer: two rows with the same ID but different notes will both appear.

Check the handoff

Before sharing the cleaned workbook, compare the row count with the original and check several records you expected to be removed. Confirm that the surviving rows have the right dates and that adjacent fields still belong to the same account. Watch for near-matches caused by extra spaces, inconsistent spelling, or IDs stored in different formats; an exact-match cleanup may not catch them.

For a recurring report, write down the matching columns, sort order, and treatment of blanks. You can ask an AI assistant to help draft that checklist using fictional column names, but don't paste sensitive customer records into a tool without your organization's approval. Review any suggested formula against a small copy first. Don't guess whether it works. Run the result.

Last revised · 2026-11-13 21:30
Letters
Readers Write

No letters yet — be the first to write.

Write a letter
© 2026 Useful by Friday. Useful by Friday