Excel COUNT UNIQUE

If you just need to excel count unique and move on, the boxed answer at the top is all you need. The rest of this page is for when you want to understand why it works in Excel, adapt it to a trickier version, or make it robust enough to hand to a colleague. We keep the opening short on purpose — the depth is here when you want it, not in your way when you don’t.

Exact answer

In Excel: use =COUNTIF(A:A,A2) for how many times each value repeats; count distinct values with =SUMPRODUCT(1/COUNTIF(rng,rng)) or =ROWS(UNIQUE(rng)) in Microsoft 365.

ƒxDuplicate RemoverLive
Unique values
3

2 duplicates removed · 3 kept

Runs entirely in your browser — your data never leaves this page.
=COUNTIF(A:A,A2)
Ctrl+CthenCtrl+Shift+V+Cthen+Ctrl+VPaste values · WindowsMac

What this does

Counting duplicates is really two questions. To see how often each value occurs, COUNTIF(A:A,A2) returns the frequency for that row — 1 means it is unique, anything higher means it repeats. To count how many distinct values a list contains, the classic =SUMPRODUCT(1/COUNTIF(range,range)) adds a fraction for each cell so every group of identical values sums to exactly 1; in Microsoft 365 the simpler =ROWS(UNIQUE(range)) does the same job. Keep the inputs visible and clearly labelled and the whole thing stays auditable — anyone who opens the file later, including you, can see at a glance exactly what feeds the result and change one assumption without hunting through the formula. Treat “excel count unique” as a small repeatable workflow rather than a one-off click you hope to remember next time. Use a small test block before the live file, so any surprise in the affected cells shows up while it is still harmless. When a formula is involved, keep the inputs labelled beside it, reference cells instead of typing values, and apply number formatting only after the result checks out. That turns a data step that keeps your analysis trustworthy into a method you can reuse, explain, and defend when the workbook leaves your screen.

A worked example

A column A2:A9 of fruit reads Apple, Pear, Apple, Plum, Apple, Pear, Kiwi, Plum. Put =COUNTIF(A:A,A2) beside it: Apple shows 3, Pear shows 2, Plum shows 2, Kiwi shows 1. To count the distinct fruits, =SUMPRODUCT(1/COUNTIF(A2:A9,A2:A9)) returns 4 (Apple, Pear, Plum, Kiwi), and =ROWS(UNIQUE(A2:A9)) returns the same 4 in 365. Counting duplicates answers the questions a flag cannot: how concentrated is the data, how many real customers are in a list of 5,000 rows, which value repeats most. It is the measurement step between spotting duplicates and deciding what to do about them. One habit worth forming early: name the cells that hold your inputs, so the formula reads in plain language instead of a string of cell addresses. A reviewer — or you in three months — can then follow the logic without decoding what B7 and D2 were supposed to mean, which is most of what makes a sheet maintainable.

In Google Sheets

If you are in Google Sheets rather than Excel, the good news is that the formula shown here is identical and the workflow barely changes — menus sit across the top instead of in a ribbon, and a few function names differ slightly, but anything you build here moves across with little or no rework. Keep this page bookmarked for the next time the same question comes up. Better still, rebuild the example once in your own sheet — doing it yourself, with the tool above to check against, is what turns a copied formula into a technique you own. The short version of “excel count unique”: the answer is at the top of this page, the tool proves it on your own numbers, and the sections above explain why it holds so the next variation does not stump you. Excel rewards people who reference cells instead of typing values and who keep inputs separate from formulas, because that is what makes a result you can audit months later. Build it once, deliberately, with the live tool as a check, and you convert a one-off lookup into a reusable skill — which is the whole point of learning the why and not just the what.

Common mistakes

  • Using a whole column (A:A) inside SUMPRODUCT(1/COUNTIF(...)) — the empty cells divide by zero and throw #DIV/0!; pin it to the exact range.
  • Confusing the two answers: COUNTIF gives a per-row frequency, not the number of distinct values.
  • Forgetting that COUNTIF is case-insensitive, so "apple" and "Apple" count as the same value.
  • Letting blank cells into the distinct-count range, which the 1/COUNTIF trick cannot divide.

Frequently asked questions

How do I count how many values are duplicated?

Count distinct repeats with =SUMPRODUCT((COUNTIF(rng,rng)>1)/COUNTIF(rng,rng)); it returns how many values appear more than once, each counted once.

Why does SUMPRODUCT(1/COUNTIF()) count uniques?

Each value contributes 1/(its count), so a value appearing three times contributes 1/3 three times = 1. Summed, every distinct value adds exactly 1.

Is there a COUNTUNIQUE function?

Google Sheets has =COUNTUNIQUE(range); Excel uses =COUNTA(UNIQUE(range)) in 365 or the SUMPRODUCT formula in older versions.

Other ways people ask this

On the way here you may have searched this as “excel unique count”, “count uniques in excel”, “excel formula unique count” and “excel count unique formula” — it is all the same task, and this page is the single, complete answer to it.

Why do people search for this in so many different ways?

Because the same task has many names. “excel unique count”, “count uniques in excel”, “excel formula unique count” all point at the one operation explained on this page, which is why they all lead here.