# UNIQUE formula generator

> Describe what you need and get a UNIQUE formula for Excel and Google Sheets, run on real data before you copy it. Plus 8 tested UNIQUE examples.

Source: https://spreadsheetpractice.com/tools/formula-generator/unique · Updated October 29, 2026 · Formulas and results on this page were run by the Spreadsheet Practice formula engine on November 20, 2026

UNIQUE returns each distinct value in a range once, in the order it first appears.

Describe the task at [UNIQUE formula generator](https://spreadsheetpractice.com/tools/formula-generator/unique) and get a UNIQUE formula for Excel and Google Sheets, tested on real data.

## Tested UNIQUE examples

### Remove duplicate rows with a formula

`=UNIQUE(A2:C11)`

Excel. Result on the sample sheet: 7 rows (E2:G8). [See it and try it](https://spreadsheetpractice.com/formulas/remove-duplicate-rows-with-a-formula)

### List values that appear only once

`=UNIQUE(B2:B12,FALSE,TRUE)`

Excel. Result on the sample sheet: 4 rows (D2:D5). [See it and try it](https://spreadsheetpractice.com/formulas/list-values-that-appear-only-once)

### Fix the #SPILL! error

`=UNIQUE(B2:B8)`

Excel. Result on the sample sheet: 4 rows (E2:E5). [See it and try it](https://spreadsheetpractice.com/formulas/spill-error-blocked-range)

### Count unique combinations of two columns

`=ROWS(UNIQUE(A2:B13))`

Excel. Result on the sample sheet: 10. [See it and try it](https://spreadsheetpractice.com/formulas/count-unique-combinations-of-two-columns)

### Get a list of unique values

`=SORT(UNIQUE(B2:B10))`

Excel. Result on the sample sheet: 5 rows (D2:D6). [See it and try it](https://spreadsheetpractice.com/formulas/list-unique-values)

### Count unique values

`=COUNTA(UNIQUE(A2:A10))`

Excel. Result on the sample sheet: 5. [See it and try it](https://spreadsheetpractice.com/formulas/count-unique-values)

### Get unique values

`=SORT(UNIQUE(FILTER(B2:B,B2:B<>"")))`

Google Sheets. Result on the sample sheet: 5 rows (D2:D6). [See it and try it](https://spreadsheetpractice.com/formulas/unique-values-from-a-whole-column)

### Count unique values with criteria

`=COUNTA(UNIQUE(FILTER(A2:A13,B2:B13=G1)))`

Excel. Result on the sample sheet: 5. [See it and try it](https://spreadsheetpractice.com/formulas/count-unique-values-with-criteria)

## Questions

### What does the UNIQUE formula generator do?

You describe the task in plain English, and it writes the formula, using UNIQUE where that's the right tool, for your table or a sample one. The formula is run in our engine in Excel and Google Sheets mode before you see it, so you get its result, not just a guess.

### What does UNIQUE do?

UNIQUE returns each distinct value in a range once, in the order it first appears.

### Can I learn to write UNIQUE formulas myself?

Yes. Each example below opens a page where you try the formula in a live grid and it's checked as you go, and the UNIQUE function page has a practice exercise.

---

Spreadsheet Practice (https://spreadsheetpractice.com) teaches spreadsheet formulas by practice: every exercise is graded in a live grid and re-checked on changed data.
