Google Sheets UNIQUE on Specific Columns Only
In this article
To get unique rows based on only specific columns, use UNIQUE on a helper range that contains just those columns — or, if you cannot move the data, wrap UNIQUE around ARRAYFORMULA and CHOOSEROWS/SORT so it only sees the columns you care about. UNIQUE itself always compares every column you hand it, so the trick is deciding which columns you hand it, not adding an option to the function.
The simplest reliable version is to copy the columns you want into a blank area of the sheet (or a second tab) and run =UNIQUE(B2:D) on that block. When you want it dynamic and self-updating, use =UNIQUE(CHOOSEROWS(B2:F,SEQUENCE(ROWS(B2:F)),3,4,5))-style formulas or =UNIQUE(FILTER(B2:F,B2:B<>"")) to narrow the input before deduplicating. Menu wording and function availability can differ slightly by account type, region and app version.
What You'll Need
- A Google account and access to Google Sheets in a browser (the desktop web version is the easiest place to type array formulas; the Sheets mobile app accepts them but editing long formulas on a phone is painful).
- A sheet with the columns already filled in, and at least one completely blank column or tab to hold a helper range if you use the copy method.
- A clear idea of which columns define a "duplicate" for your data — for example, email address only, or first name plus last name plus phone.
Step-by-Step
- Decide the key columns. Write down which columns together decide uniqueness. If you want one row per customer, the key might be the email column alone. If you want one row per product per store, the key might be product ID plus store code. UNIQUE compares whole rows, so the set of columns you feed it is exactly the set it treats as the identity.
- Pick a destination. Click a blank cell on the same tab or, better, open a new tab (the plus sign at the bottom-left of the sheet) so the output does not overwrite anything. Leave at least one empty row below and to the right of where the result will spill.
- Run the basic copy method first. Select only the columns you decided on, copy them, and paste them into the destination area. Then in the first empty cell beside the pasted block type
=UNIQUE(A2:C), replacing A2:C with the pasted range. This gives you a clean, easy-to-read list of unique combinations of those columns. - Make it dynamic with FILTER plus UNIQUE. If your data sits in B2:F and you only want to dedupe on columns B, C and D, you cannot shrink a range with a plain reference. Use
=UNIQUE(FILTER(B2:D,B2:B<>"")). FILTER keeps only rows where column B has a value, which removes the trailing blank rows that would otherwise show up as a stray 0 or empty row in the UNIQUE output. - Use CHOOSEROWS when the key columns are not adjacent. Suppose the key is columns B, D and F but you also want to keep column C for reference. Build a temporary array of just the key columns with
=CHOOSEROWS(B2:F,SEQUENCE(ROWS(B2:F)),1,3,5)and wrap it:=UNIQUE(CHOOSEROWS(B2:F,SEQUENCE(ROWS(B2:F)),1,3,5)). Numbers 1, 3 and 5 refer to positions inside the range B2:F (B, D, F). If CHOOSEROWS is not available in your account, sort the columns so the key columns sit together and use the FILTER method instead. - Add COUNTIF to see how many duplicates each unique row had. In the column next to your UNIQUE result, enter
=COUNTIF($B$2:$B,$A2)(adjust the range and the cell reference) and drag it down. This tells you whether a row appeared once or five times, which is often the real question behind deduplicating. - Convert to values if you need to edit the result. UNIQUE returns a spilled array; you cannot type over a single cell inside it. Select the spilled block, copy, then use Edit > Paste special > Values only (or right-click > Paste special > Values only). After that the block behaves as ordinary data you can sort, delete rows from or paste elsewhere.
- Sort the result if order matters. Wrap the formula:
=SORT(UNIQUE(FILTER(B2:D,B2:B<>"")),1,TRUE)sorts the unique list by its first column, A to Z. Change the last argument to FALSE for Z to A, or change the column number to sort on the second or third column of the output. - Check the count. Put
=COUNTA(B2:B)next to=COUNTA(G2:G)(where G holds the UNIQUE output) and compare. The difference is your duplicate count. If the two numbers match, either there were no duplicates or the formula is pointing at the wrong range.
Common Mistakes
- Expecting UNIQUE to take a column list. There is no syntax like UNIQUE(range, "column B"). The function only compares whole rows of whatever range you give it, so the column selection has to happen before it runs.
- Including an extra column by accident. B2:E instead of B2:D pulls in a timestamp or note column, and every row now looks unique. This is the single most common reason "UNIQUE is not working."
- Leaving header rows in. A header row inside the range counts as data; it will appear in the output and can even mask nothing at all. Start ranges at row 2, or wrap with a header-aware approach.
- Blank rows and zero rows. References like B2:F overstate the data and pull in empty rows. The output then shows 0 or blank unique rows. FILTER with a non-blank test fixes it.
- Typing inside the spill range. Any content in the cells where a result wants to expand produces a #REF! error. Clear the whole area below and to the right of the formula.
- Mixing text and numbers. "123" stored as text and 123 stored as a number are different values to UNIQUE, so identical-looking rows survive as duplicates.
- Forgetting case sensitivity. UNIQUE treats "Smith" and "smith" as the same value; do not assume it will separate them.
Tips
- Put the helper UNIQUE formula on a separate tab named something like "Unique list" and point your lookups at that tab. It keeps your raw data untouched and makes debugging obvious.
- Use
=UNIQUE(SORT(range))so the input and output are both sorted; it makes eyeballing the result much faster. - Combine with TRIM before deduplicating if your data has stray spaces:
=UNIQUE(ARRAYFORMULA(TRIM(B2:D)))catches duplicates caused by trailing spaces. - If you only want the count of unique values rather than the list, use
=COUNTA(UNIQUE(B2:B))or=COUNTUNIQUE(B2:B). - Freeze the header row (View > Freeze > 1 row) so you always know which column is which when adjusting ranges.
Troubleshooting
- #REF! appears. The output is blocked. Clear the cells beneath the formula, including any stray spaces, apostrophes or hidden content, then let the formula recalculate.
- The output has a row of zeros. Your range extends past your data. Switch to FILTER with a non-blank condition or shrink the range.
- Duplicates remain. Recheck the exact range. One extra column means no rows will ever match. Also check for trailing spaces or numbers stored as text.
- #NAME? error. A function name is misspelled or the function is not available on your account; try the FILTER-based method instead of CHOOSEROWS.
- The formula is slow. Covering an entire column like B2:B with UNIQUE on a huge sheet can slow recalculation. Limit the range to the actual data.
- The result will not update after you add rows. If you used a fixed range, extend it, or leave a generous buffer.
Frequently Asked Questions
Can UNIQUE target specific columns directly?
No. UNIQUE compares whole rows of the range you give it. You select the columns first, either by copying them to a helper range or by using FILTER or CHOOSEROWS to build a narrower array.
Does UNIQUE treat "Smith" and "smith" as different?
No, it treats them as the same value. Use an exact-match approach with a helper column of LOWER() values if you need case-sensitive results.
Can I keep the other columns in the output?
Yes, with a lookup. Build the unique key list first, then use VLOOKUP or XLOOKUP to pull the other columns from the original data.
Why does my UNIQUE formula show only one row?
The range is probably a single cell or points at the wrong area. Check the range reference and confirm there is space for the result to expand.
Does UNIQUE remove blank cells?
It can produce an empty unique row if blanks are inside the range. Filter them out with =UNIQUE(FILTER(range,range<>"")).