Sub topic 9
Deduplicate with a Formula: UNIQUE
Assume you know how to select ranges, enter formulas, and use Google Sheets menus. This chapter uses a cleaned table in columns A:C, with headers in row 1 and data beginning in row 2.
UNIQUE creates a new list containing only distinct rows. It does not delete or change the source data. This makes it safer than deleting duplicates directly when you still need to compare the results.
Return distinct rows
Suppose a customer table contains these columns:
| Name | Region | |
|---|---|---|
| Ana Lee | [email protected] | East |
| Ben Fox | [email protected] | West |
| Ana Lee | [email protected] | East |
To create a deduplicated copy, select an empty cell, such as E2, and enter:
=UNIQUE(A2:C)The result spills into the cells below and beside E2. In this example, the repeated Ana Lee row appears only once.
A spilled result is a result that fills multiple cells automatically from one formula. Leave the cells below and to the right of the formula empty. Any existing value in the output area can cause an error or prevent the full result from appearing.
UNIQUE compares complete rows when you provide multiple columns. Two rows are duplicates only when every selected column has the same value. If the names and emails match but the regions differ, Sheets treats those rows as different.
Deduplicate one column
To create a list of distinct email addresses, use a one-column range:
=UNIQUE(B2:B)This is useful for building a list for validation, counting customers, or checking which values occur in a source column. The output order usually follows the first appearance of each value in the source range.
Do not include the header in the range unless you want the header treated as data. If you place the formula in a new table, type the output header separately, such as Name, Email, and Region.
Clean before deduplicating
Visible duplicates may not be technically identical. For example, Ana Lee and Ana Lee contain different text if the second value has a trailing space. Different capitalization can also prevent a match.
Clean the source first with TRIM, or create a helper column. For a single name column, this formula removes extra spaces:
=ARRAYFORMULA(TRIM(A2:A))If capitalization is inconsistent, standardize it before comparing values:
=ARRAYFORMULA(PROPER(TRIM(A2:A)))Then use the cleaned columns as the input to UNIQUE. This separates two decisions:
- What counts as the same value?
- Which copy should remain in the final table?
UNIQUE keeps the first matching row it encounters. It does not decide which row has the newest date, the most complete address, or the correct spelling. If duplicate rows contain conflicting information, review them before replacing the original data.
Formula output versus the menu tool
Use UNIQUE when the source data may change and you want the result to update automatically. Use Data cleanup > Remove duplicates when you have reviewed the table and want to remove duplicate rows from the selected range itself.
| Method | Changes source data? | Updates automatically? | Best use |
|---|---|---|---|
| `UNIQUE` | No | Yes | A safe, repeatable deduplicated view |
| Remove duplicates | Yes | No | A final cleanup of a copied table |
The formula is reversible: delete it, and the source remains available. The menu command is a direct edit, so use it on a copy when the original data may be needed for auditing.
Exercise
Your table has headers in row 1 and data in columns A through C. Which formula creates a deduplicated copy without changing the original table?
Show answer
Enter =UNIQUE(A2:C) in an empty cell outside the source table.