← All how-to recipes

How to get unique values (remove duplicates) with a formula

✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)

Return the distinct values from a column with a formula, dropping duplicates — without the Data > Remove duplicates menu.

The formula

AppFormulaNotes
Excel=UNIQUE(A2:A9)Excel 365+. Result spills down automatically.
Google Sheets=UNIQUE(A2:A9)Native in Google Sheets; spills.
LibreOffice Calc=UNIQUE(A2:A9)LibreOffice 25.8 (UNIQUE arrived in 24.8; earlier versions return #NAME?).

How it works

UNIQUE scans the range top-to-bottom and keeps the first occurrence of each value, so duplicates are dropped while original order is preserved. It is a dynamic-array function: type it in one cell and the results spill into the cells below.

Verified, not just documented

We ran =UNIQUE(A2:A6) in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned apple, banana, cherry — exactly the expected result. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned apple, banana, cherry for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run Excel.

Functions used

UNIQUE — see full Excel, Google Sheets & LibreOffice compatibility for each.

Related recipes

Related comparisons