On this page15 sections
- 1Five ways to find and remove duplicates
- 2How to highlight duplicates in Google Sheets
- 3Highlight only the rows Remove duplicates would delete
- 4How to highlight duplicate rows on more than one column
- 5How to remove duplicates with Data cleanup
- 6How to remove duplicates with the UNIQUE function
- 7How to remove duplicates in one column
- 8How to keep the last copy, or remove both copies
- 9How to find and count duplicates with a pivot table
- 10How to remove duplicates across two sheets or two files
- 11Why Sheets misses some duplicates
- 12Is there a remove duplicates option on the Sheets app?
- 13Do it in one go with the free Deduplicate tool
- 14Before the list goes into a CRM
- 15Frequently asked questions
Five ways to find and remove duplicates
Remove duplicates is the quickest, but it deletes rows in place. The others leave your data alone.
| Method | Use it for | Changes your data |
|---|---|---|
| Conditional formatting | Finding and highlighting duplicates before you delete anything | No, it only colors cells |
| Data cleanup > Remove duplicates | A one-off cleanup of a list | Yes, it deletes rows |
| UNIQUE function | A duplicate-free copy that updates when the list changes | No, it writes a new list |
| Pivot table | Counting how many times each email appears | No, it builds a table on its own sheet |
| COUNTIF helper column | Checking a new list against one you already have | It adds one column |
How to highlight duplicates in Google Sheets
Conditional formatting colors every value that appears more than once, so you can look before anything is deleted. In Sheets it takes a custom formula, the one Google's help gives for this. The example checks emails in column B, starting at row 2.
Select the column
Select B2:B, the emails without the header.
Open conditional formatting
Go to Format > Conditional formatting. The rules panel opens on the right with your range filled in.
Use a custom formula
Under Format rules, set Format cells if to Custom formula is, and enter
=COUNTIF($B$2:$B,B2)>1. COUNTIF counts how often each email appears in the column, ignoring letter case, and the rule colors the ones that appear more than once.Pick a color and click Done
Every repeated email is now filled in, the first copy included. To look through them together, go to Data > Create a filter, click the filter button on the email column and choose Filter by color, then Fill color.

Highlight only the rows Remove duplicates would delete
The rule above colors every copy, including the first one, which Remove duplicates keeps. To see only the rows that would go, change the formula to =COUNTIF($B$2:$B2,B2)>1.
The range now ends on the row being checked, so each cell counts only the emails above it and itself. The first copy of an email counts 1 and stays plain, and the second and later copies are colored. Those are the rows Remove duplicates deletes when Email is the only column checked.
How to highlight duplicate rows on more than one column
To color the rows that match on two columns, say the same email and the same company, with companies in column C, select A2:D and use COUNTIFS: =COUNTIFS($B$2:$B,$B2,$C$2:$C,$C2)>1. A row is colored only when another row has the same value in both. Add another range and cell pair for each extra column.
Some guides join the columns with & inside ARRAYFORMULA and count the joined text. That can count two different rows as one: account 12 in region 3 and account 1 in region 23 both join to 123. COUNTIFS compares each column on its own.
How to remove duplicates with Data cleanup
Remove duplicates deletes the duplicate rows from the sheet immediately, so highlight them first, as above, if you want to see what goes.
Select the whole range
Select every column of your list, headers included, not only the column with the duplicates. Sheets only works on the cells you select, so a single column selected on its own loses cells from that column while the rest of each row stays put, and the rows no longer line up. If you do start from one column, the dialog offers an Expand button (such as Expand to
A:D): click it. Google's help adds that a single cell selected inside the list works too, and duplicates are removed across the whole list.
Open Remove duplicates
Go to Data > Data cleanup > Remove duplicates. On a UK English account the menu is called Data clean-up.
Check Data has header row
It starts unchecked. If the first row is headers, check Data has header row. Sheets then shows your column names in the list and leaves the header row out of the comparison.

With Data has header row checked, the list shows the column names. Here every column is checked, so only rows that match in all four count. Choose the columns to analyze
Check only the columns that define a duplicate. With Select all checked, two rows count as duplicates only when every cell matches, so one different phone number keeps both. For a contact list, Email on its own is usually what you mean.
Click Remove duplicates
Sheets deletes the duplicate rows and tells you how many it found and removed and how many unique rows remain. If the number is far off what you expected, undo with Edit > Undo, or Ctrl+Z (Cmd+Z on a Mac) once the message has closed, and look at which columns you checked.

How to remove duplicates with the UNIQUE function
UNIQUE leaves your original list alone and writes a copy without the duplicates somewhere else. Click an empty cell with enough room below and to the right of it, and type the formula.
For whole rows, give it every column: =UNIQUE(A2:D) returns each distinct row once. An open range like A2:D also returns one empty row at the end, from the blank rows below your data. For one column, give it that column: =UNIQUE(B2:B) returns the list of distinct values in column B, which is how you get a clean list of companies or countries from a long sheet.
The result updates when the original changes. To keep it as a fixed list, select the result, copy it, and paste it back with Edit > Paste special > Values only.
How to remove duplicates in one column
There are two different jobs here, and Data cleanup does both depending on what you select.
To remove rows that share a value in one column, such as the same email, select the whole list and check only that column under Columns to analyze. Sheets compares that one column and deletes the whole row for each duplicate.
To get a clean list of the values in one column, such as every company once, use =UNIQUE(B2:B) in an empty column or on a new tab. The original column and the rest of the sheet stay as they are.
Selecting one column on its own and running Remove duplicates on it is the one to avoid when the column is part of a list. The dialog offers to expand the selection to the whole list; if you go ahead without it, Sheets deletes cells from that column only, the cells below move up, and from then on each value sits next to someone else's row.

How to keep the last copy, or remove both copies
Remove duplicates keeps the first row of each set, so the row you want to keep has to come first. To keep the most recent copy, sort the list newest first before you remove duplicates: select the whole list, go to Data > Sort range > Advanced range sorting options, check Data has header row, choose your date column and Z to A, so the newest date comes first, and click Sort. Then run Remove duplicates as above, and the newest row of each set is the one that stays.
To remove both copies, so only the rows that appear once are left, give UNIQUE a third argument of TRUE: =UNIQUE(A2:D121, FALSE, TRUE). Google's help calls it exactly_once, which returns only the entries with no duplicates. For one column, =UNIQUE(B2:B121, FALSE, TRUE) lists the emails that appear only once. Change A2:D121 to your own list's range.
How to find and count duplicates with a pivot table
A pivot table counts how many rows share each email, which Remove duplicates doesn't tell you, and your list stays as it is.
Select the list
Select the whole list, headers included. Every column needs a header for a pivot table.
Insert the pivot table
Go to Insert > Pivot table. The pivot table goes on its own sheet; click that sheet's tab if it isn't already open.
Add Email under Rows
In the side panel, next to Rows, click Add and choose Email. The emails are listed down the pivot table.
Count the rows for each email
Next to Values, click Add and choose Email again, then under Summarize by, choose a count. The number next to each email is how many rows in your list have it.
Sort the repeats to the top
Under Rows, click the arrow under Sort by and choose the count, then under Order put the biggest counts first. Every email with a count over 1 is a duplicate. Double-click a count to open the rows behind it on a new sheet.
How to remove duplicates across two sheets or two files
Use this to check a new list against one you already have, such as this week's sign-ups against the contacts you imported last month. A helper column counts how often each new email appears in the old list, and the rows with a count of 0 are the new ones.
This example has the new list on a tab called New and the old list on a tab called Old, with the emails in column B of both. In the first empty column of New, say E2, enter =COUNTIF(Old!$B$2:$B, B2) and copy it down to the last row. COUNTIF ignores letter case, so JANE@QUELLBROOK.EXAMPLE in one list and jane@quellbrook.example in the other count as the same email.
To see only the new rows, select the list, go to Data > Create a filter, click the filter button at the top of column E, choose Filter by values and leave only 0 checked. If Create a filter is grayed out, remove the highlight rule from Format > Conditional formatting first: Google says a conditional formatting rule on the sheet can make the filter unavailable. To remove the rows that are already in the old list, sort the list by column E, A to Z, instead (Data > Sort range > Advanced range sorting options), so every 0 sits together at the top, and delete the rows below them.
When the old list is in another file, bring it into a tab first with IMPORTRANGE. On a new tab called Old, in A2, enter =IMPORTRANGE("<URL of the old file>", "Sheet1!A2:D"), with the old file's address from your browser and its tab's name, so the emails land in column B from row 2, where the COUNTIF column looks. The first time, the cell shows #REF! until you connect the two files: click the cell, then Allow access. If someone else owns the old file, you have to request access to it and wait for the owner to grant it. Then add the same COUNTIF column.
Why Sheets misses some duplicates
Remove duplicates looks for identical values, ignoring letter case, so QUELLBROOK and Quellbrook count as the same. Anything else that differs keeps both rows:
| What it misses | Example | What to do in Sheets |
|---|---|---|
| Extra spaces | jane@quellbrook.example with a space at the end | Run Data > Data cleanup > Trim whitespace on the column first. It leaves non-breaking spaces, which come in with text copied from web pages. A CSV brought in with File > Import, with Convert text to numbers, dates, and formulas checked, has its spaces at the ends trimmed already. |
| Spelling and typos | Jon Smith and John Smith, or Quellbrook Ltd and Quellbrook Limited | Nothing built in. You find them by eye, sorted by name. |
| The same person with two emails | jane@quellbrook.example and jane.doe@quellbrook.example | Check more columns, such as first name, last name and company, and check what comes up before you delete. |
| Duplicates in two files | The same lead in this week's list and last week's | Check one list against the other with a COUNTIF column, as in removing duplicates across two sheets above, or copy both lists into one tab, one under the other with one header row, then remove duplicates. |
Is there a remove duplicates option on the Sheets app?
No. Remove duplicates is on the computer version of Sheets only, as are Trim whitespace and Split text to columns. Google's help for the Android app and for the iPhone and iPad app says to open the spreadsheet at sheets.google.com on your computer for all three.
Do it in one go with the free Deduplicate tool
Operelio's Deduplicate does the finding, the check and the removal in one run, on the file itself. Download the sheet with File > Download as a CSV or Excel file, upload it, pick the columns that define a duplicate, and check the preview, which shows your own rows grouped as duplicates before anything is removed. You choose whether the first or the last row of each group stays, so there's no sorting first to keep the newest.
It also catches what Sheets misses. It ignores case and trims spaces by default. Smart matching treats emails, phone numbers and company names that mean the same thing as the same, such as Quellbrook Ltd and Quellbrook, Ltd., or +1 (415) 555-0123 and 415-555-0123. With a free account, Similarity matching also catches typos like Jon Smith and John Smith. The rows it removes come back as a separate file you can check, and your original file is never changed.
For duplicates spread across several files, combine them first with Merge Files, then run Deduplicate on the result. All three ways of matching are on the Free plan, for files up to 2,000 rows. Without an account, the tool page offers Exact and Smart.

Before the list goes into a CRM
When the list goes into a CRM, the CRM checks for duplicates again, this time against the records it already holds, and HubSpot and Salesforce check in different ways.
HubSpot matches contacts on email, so two rows with the same email update one contact, while one person under two emails, or a row with no email, becomes a new contact. How to find, merge and prevent duplicate contacts in HubSpot covers the ones already in there.
Salesforce runs duplicate rules. A row that comes in through an import tool or the API and matches an active rule isn't saved, even under the standard rules, which are set to Allow. Salesforce duplicate rules: what they do to imports and APIs says which rules match what, so you can check them before a big load.
To push the cleaned list into HubSpot, Salesforce or Pipedrive and see what it will create, update and skip before it runs, see importing into a CRM with a preview first. For the whole job, from the list to the CRM, see removing duplicate contacts before import.
Frequently asked questions
How do I remove duplicates in Google Sheets?
Select the whole list, go to Data > Data cleanup > Remove duplicates, check Data has header row if you have headers, check the columns that define a duplicate, and click Remove duplicates. Sheets deletes the repeats and keeps the first row of each set.
How do I highlight duplicates in Google Sheets?
Select the column, say B2:B, go to Format > Conditional formatting, set Format cells if to Custom formula is and enter =COUNTIF($B$2:$B,B2)>1, then pick a color and click Done. Every email that appears more than once is colored. Use =COUNTIF($B$2:$B2,B2)>1 to color only the second and later copies.
Does Remove duplicates delete the whole row?
Yes, when you select the whole list. It compares the columns you check and deletes every cell of each duplicate row in your selection. If you select only one column, it deletes cells from that column only, which misaligns the rest of the sheet.
Can I undo removing duplicates in Google Sheets?
Yes. Press Ctrl+Z (Cmd+Z on a Mac) right after. Later on, go to File > Version history > See version history, open a version from before the change, and restore it or copy the rows you need back.
How do I keep the first or last duplicate?
Sheets always keeps the first row of each set, so sort the list before you remove duplicates to put the row you want first. To keep the most recent row, sort by a date column newest first with Data > Sort range. Operelio's Deduplicate lets you choose first or last directly.
Why didn't Remove duplicates find my duplicates?
Because the rows aren't the same in the columns you checked. With every column checked, one different phone number keeps both rows, so check only the columns that define a duplicate, such as Email, as in removing duplicates with Data cleanup. Extra spaces, typos, a company spelled two ways and the same person under two emails also keep both rows: why Sheets misses some duplicates says what to do for each. The UNIQUE function counts letter case too, and a copy in another list needs removing duplicates across two sheets.
Can I remove duplicates with the QUERY function?
The simplest way to get a copy of the list without duplicates is the UNIQUE function, which returns each row once and leaves the original as it is.

