Count Unique Values in a Column
A column lists repeated entries — customer names on orders, SKUs on transactions — and you need how many *different* ones there are, not how many rows.
Excel & Google Sheets
How it works
The universal version is a classic trick: COUNTIF(A2:A7,A2:A7) counts how often each entry appears, and 1 divided by that count makes every copy of an entry contribute a fraction summing to exactly 1 — three Acmes contribute ⅓ + ⅓ + ⅓. SUMPRODUCT adds the fractions, giving the number of distinct entries. The modern platforms have cleaner answers: Excel 365 spills the distinct list with UNIQUE and counts it with ROWS; Google Sheets has a dedicated COUNTUNIQUE.
When to use it
Use it for distinct customers in an order log, different products sold this month, unique error codes in an export — any "how many different X" question.
Common mistakes
Did this formula help?
Engine-verified against the sample data aboveLast reviewed 2026-07-08