Sub topic 7
Remove duplicate rows with the Remove duplicates tool
Repeated rows inflate counts, double-count totals, and break lookups that expect one row per key. Google Sheets includes a menu tool that deletes them in one step. This chapter explains what the tool compares, which row it keeps, and how to run it without losing data.
This chapter assumes you can select ranges and use the menu bar. It also assumes you have already made a working copy of your data and know how to remove extra spaces, as covered in the earlier chapters. Both matter here because the tool compares values exactly as they are stored.
What the tool does
The tool is at Data > Data cleanup > Remove duplicates. It looks at the rows in your selected range and compares them using the columns you choose. When two or more rows match on those columns, it keeps the first one, counting from the top, and deletes the rest. When it finishes, it reports how many duplicate rows it found and how many unique rows remain.
Three points follow from that behavior:
- It changes the sheet. The rows are deleted from the sheet, not hidden. Undo works right after the run, but you shouldn't rely on it later.
- It keeps the first occurrence. The tool has no concept of "newest" or "most complete". Row order decides which row survives.
- It compares only the columns you tick. Two rows can differ in other columns and still count as duplicates.
Run it step by step
Suppose your copy of an import has this data in A1:D7. The column headers are in row 1.
| Order ID | Date | Status | |
|---|---|---|---|
| 1001 | [email protected] | 2026-11-01 | Shipped |
| 1002 | [email protected] | 2026-11-02 | Pending |
| 1001 | [email protected] | 2026-11-01 | Shipped |
| 1003 | [email protected] | 2026-11-05 | Pending |
| 1002 | [email protected] | 2026-11-02 | Shipped |
| 1004 | [email protected] | 2026-11-06 | Pending |
- Select the data range, for example A1:D7. Selecting a single cell inside the table also works in many cases, but an explicit range is safer because you can see what the tool will touch.
- Choose Data > Data cleanup > Remove duplicates.
- In the dialog, tick Data has header row if your selection includes headers. This stops the tool from treating the header as a data row and lets you pick columns by name.
- Under Columns to analyze, choose the columns that define a duplicate. Select all compares entire rows.
- Click Remove duplicates, then read the result message.
With all four columns selected, only row 4 (the second 1001 row) is an exact copy of an earlier row. The tool deletes it and reports one duplicate removed. Rows 1002 differ in the Status column, so they survive.
Choose the columns deliberately
The columns you tick define what "duplicate" means. The same data gives different results depending on that choice.
| Columns ticked | Rows removed from the example | Rows remaining |
|---|---|---|
| All four | The repeated 1001 row | 5 |
| Order ID | The repeated 1001 row and the second 1002 row | 4 |
| Every later row for [email protected] and [email protected] | 3 |
Ticking only Email would delete order 1003, which is a different order from the same customer. Whether that's right depends on what one row represents. If a row is an order, the key is Order ID. If a row is a customer, the key is Email. Decide this before you open the dialog.
Control which row survives
Because the tool keeps the first row it meets, sort the data before you run it if the choice matters. To keep the most recent record per customer:
- Sort the range by the Date column, newest first, using Data > Sort range.
- Run Remove duplicates with Email ticked.
- Sort back to your preferred order if needed.
Add a column with the original row number before sorting if you need to restore the import order afterward. Without it, you can't recover the original order.
What counts as identical
The tool compares stored values exactly. That is why the earlier chapters on trimming and hidden characters come first. These pairs are not duplicates to the tool:
[email protected]and[email protected](a trailing space)SmithandSmithwhere one contains a non-breaking space (character 160) that looks like a normal space- The number
1001and the text"1001"(a number stored as text) - Values that differ only in letter case, in some cases
The last item depends on how the tool treats capitalization, which you should not assume. Test it before relying on it: type Apple, apple, and APPLE in three rows of a scratch sheet and run the tool on that range. The result tells you how your version behaves. If you want the answer not to matter, standardize case first with the LOWER or PROPER approach from the capitalization chapter.
A cheap safeguard is to trim and normalize the key columns in your working copy before deduplicating. Paste the cleaned values back as values only, so the tool compares stored text and not formulas.
Blank rows and partial rows
Rows that are entirely empty within the selection match each other. The tool treats them as duplicates and keeps one. This is usually harmless, but it can remove spacing you wanted, and it can leave one stray blank row in the middle of your data.
Rows with blanks in some columns behave as you would expect. Two rows with an empty Email and the same Order ID match if you tick both columns. Be careful when you tick a column that is often empty, such as a secondary phone number. Every row with a blank in that column looks the same on that column.
Estimate the damage before you delete
You can preview how many rows will go by comparing counts. For a single key column, this formula returns the number of repeated values in column A, starting at row 2:
=COUNTA(A2:A)-COUNTA(UNIQUE(A2:A))If the number differs from the tool's result message, investigate. A common cause is that UNIQUE and the tool handle case or hidden characters differently. The next chapter covers a COUNTIF helper column that lets you review each duplicate row before deleting anything. UNIQUE is covered after that.
Verify after running
Do these checks after every run:
- Read the message: it gives the number removed and the number remaining. Compare that to your preview.
- Check that the row count equals the original count minus the number removed.
- Spot-check three or four keys that you know had repeats. Search the sheet with Ctrl+F (Cmd+F on Mac) and confirm each appears once.
- Check any formulas in other sheets that referenced rows in this range. Deleted rows can leave references to ranges that have shifted, or cause
#REF!errors if a formula pointed at a specific deleted cell. - If something looks wrong, press Ctrl+Z immediately, or restore from File > Version history.
When to use the tool and when to use a formula
The tool and the UNIQUE function solve the same problem in different ways.
| Situation | Better choice |
|---|---|
| One-time cleanup of a copy you are done with | Remove duplicates tool |
| Source data keeps changing, and the clean list must update | UNIQUE formula |
| You need to see which rows are repeats before deleting | COUNTIF helper column |
| You must keep the raw data untouched | UNIQUE, placed on another sheet |
Common errors
- "No duplicates found" when you can see repeats. The values differ in spaces, hidden characters, case, or data type. Trim, clean, and normalize the key columns, then rerun.
- Too many rows removed. You ticked too few columns. Undo and add the columns that distinguish real records.
- Header row deleted or treated as data. You left Data has header row unticked. Undo and run it again with the box ticked.
- Wrong row kept. Sort first so the row you want comes first.
- Rows removed from the wrong place. The selection included more than the table. Select the exact table range and test on a copy first.
Exercise
A sheet lists support tickets with the columns Ticket ID, Customer Email, Opened, and Priority. The same ticket appears several times because the export ran more than once, and the later copies have an updated Priority. You want one row per ticket, using the most recent copy. The Opened column has the same date on every copy. A separate column, Exported, holds the export time. Describe the steps you would take, including which columns you tick in the tool.
Show answer
Work on a copy of the sheet. Trim and clean the Ticket ID column so hidden spaces do not hide real duplicates. Sort the range by Exported, newest first, so the latest copy of each ticket is the first row for that ticket. Select the table, open Data > Data cleanup > Remove duplicates, tick Data has header row, and tick only Ticket ID, because that column alone defines a unique ticket. Ticking Priority or Exported would keep the older copies, since those values differ between copies. Run the tool, then check that the remaining row count equals the number of distinct Ticket IDs and that a few known tickets show the updated Priority.