The fastest way to remove duplicates in Google Sheets is to use the UNIQUE formula: =UNIQUE(A2:A) returns a list with duplicates removed. For a permanent deletion without a formula, select your data range and go to Data > Data cleanup > Remove duplicates.
Why Duplicates Appear and Why They Matter
Duplicates in a spreadsheet usually come from merged datasets, manual entry, or importing records from multiple sources. They can skew totals, break VLOOKUP or XLOOKUP matches, and make pivot tables misleading. For example, if a sales log lists the same order twice, a SUM of the order column will overstate revenue. Removing duplicates is a core data-cleaning step before any analysis or reporting.
The UNIQUE Function: How It Works
The UNIQUE function is the simplest formula-based method. It takes a range or array and returns only distinct rows. The syntax is:
=UNIQUE(range)
For instance, with names in A2:A20, enter =UNIQUE(A2:A20) in cell C2. The result spills down automatically, listing each name once. If you have multiple columns, like first name in A and last name in B, use =UNIQUE(A2:B20) to remove rows where both columns match. The formula updates live if you change the source data.
One key detail: UNIQUE is case-sensitive. “Apple” and “apple” are treated as different values. If you need case-insensitive removal, combine with LOWER or UPPER in an array formula, but that changes the output case. For most practical cases, exact matches are what you want.
Using the Built-in Remove Duplicates Tool
If you want to delete duplicates permanently without a formula, use the menu tool. Steps:
- Select the range that contains duplicates (e.g., A1:C50).
- Click Data in the top menu.
- Hover over Data cleanup and select Remove duplicates.
- In the dialog, check whether your data has a header row.
- Choose which columns to consider (by default all selected columns are checked).
- Click Remove duplicates.
This permanently deletes the extra rows. It also shows a summary of how many rows were removed. Unlike the formula method, this is destructive—so save a copy of your sheet first if you might need the original data.
Comparing UNIQUE vs. Remove Duplicates Tool
Both methods work, but they serve different needs. The UNIQUE formula is dynamic—it recalculates when the source changes, making it ideal for ongoing data entry. The tool is static and permanent, better for one-time cleanups. Also, the tool can remove duplicates based on a subset of columns (e.g., only check email, ignore name), while UNIQUE always considers the entire row unless you use helper columns.
Another difference: UNIQUE outputs to a new location, leaving the original untouched. The tool modifies the original range in place. If you need to keep the original intact, use the formula. If you need to reduce file size or clean a messy sheet, use the tool.
Common Problems and Solutions
Here are typical issues people hit when removing duplicates:
- Trailing spaces: “John ” and “John” look the same but aren’t. Use
=TRIM(A2)in a helper column first, then run UNIQUE on that column. - Numbers stored as text: 123 and “123” are different. Use
=VALUE(A2)or the menu Format > Number > Automatic to convert. - Case differences: As noted, UNIQUE is case-sensitive. Use
=UNIQUE(ARRAYFORMULA(LOWER(A2:A20)))to get lowercase unique values, but you lose original casing. - Blank cells: UNIQUE will return a blank row if your range includes empty cells. Filter them out with
=FILTER(UNIQUE(A2:A), UNIQUE(A2:A)<>""). - Duplicates in multiple columns: If you only want to remove rows where both name and email match, select both columns in the tool. With UNIQUE, the formula automatically checks all columns in the range.
Advanced: Removing Duplicates with QUERY or SORTN
For more control, you can use QUERY or SORTN. For example, to get unique rows from A2:B20, you can use:
=QUERY(A2:B20, "select A, B where A is not null group by A, B")
This groups by both columns, effectively removing duplicates. It also filters out blanks. Another option is SORTN, which can return unique rows based on a specific column:
=SORTN(A2:B20, 9^9, 2, 1, TRUE)
Here, 9^9 means return all rows, 2 means return unique rows, and 1 is the column to check for uniqueness. The TRUE sorts descending. This is useful when you want to keep the first occurrence of each value in a particular column.
Frequently Asked Questions
Can I remove duplicates in Google Sheets on my phone?
Yes. In the Google Sheets mobile app, select the range, tap the three-dot menu, and choose Data > Remove duplicates. The UNIQUE formula also works on mobile, as it’s just a normal formula.
Does UNIQUE work with blank cells?
Yes, but it returns a blank row for each blank cell in the range. To avoid that, wrap it with FILTER as shown above, or use QUERY which automatically excludes nulls.
How do I remove duplicates but keep the first row?
The built-in tool always keeps the first occurrence and deletes later duplicates. UNIQUE also keeps the first occurrence in the order they appear. If you need to keep a different row (e.g., the latest date), you’ll need a more complex formula with SORTN or a helper column.
Why is my UNIQUE formula showing #VALUE! error?
This usually happens if the range includes multiple data types in the same column (e.g., numbers and text). Ensure all cells in the range are formatted consistently. Also check for merged cells, which can cause issues.
Is there a way to count unique values instead of listing them?
Yes. Use =COUNTA(UNIQUE(A2:A20)) to count the number of unique entries. Or use =COUNTUNIQUE(A2:A20) which does the same in one function.
Can I remove duplicates in Google Sheets without affecting other columns?
If you select only the columns you want to check for duplicates, the tool will delete entire rows based on those columns. To keep unrelated data, copy the range to a new sheet first, or use UNIQUE to output only the columns you need.
Related
- Google Sheets DB Function: Depreciation Explained
- Google Sheets Undo Dropdown: Quick Fixes
- How to Not Rank Zeros in Excel: 4 Fixes
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- How to Open a Corrupted Excel File Online and Recover DataTo try opening a corrupted Excel file online, first save an untouched copy, upload a duplicate to OneDrive,…
- Excel Screen Lock: How to Unlock a Sheet or Unfreeze PanesTo remove a protected-sheet lock in Excel for Microsoft 365 on Windows, open the sheet and choose Review…
- Excel ODS vs CSV: Which Format Should You Use?ODS and CSV are different spreadsheet file formats: use ODS when you need to keep a workbook’s sheets,…
- Daily Schedule in Google Sheets: Build a Practical PlannerTo make a daily schedule in Google Sheets, create columns for start time, end time, activity, and notes,…
- Find Duplicate Words in Excel: A Step-by-Step GuideTo find a word repeated inside one Excel cell, put the text in A2 and use the formula…
- Google Sheets Look for Duplicates? Find Them FastYes. In Google Sheets, use Format > Conditional formatting to highlight duplicate values, or Data > Data cleanup…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.