1COUNTA with UNIQUE
=COUNTA(UNIQUE(A2:A13))
- Make sure the range has no blank cells, or filter them out.
- Type =COUNTA(UNIQUE(A2:A13)) in an empty cell.
- To count within a condition, wrap FILTER around the range before UNIQUE.
Count distinct values in a list with COUNTA and UNIQUE, or with SUMPRODUCT and COUNTIF in any version, including a count that depends on a condition.
An order list repeats customers. You want to know how many different customers there are, not how many rows.
Counting rows is easy: COUNTA counts non-empty cells. Counting distinct values takes one more step. First reduce the list to its distinct values, then count what is left.
In current Excel, UNIQUE does the reduction, so =COUNTA(UNIQUE(A2:A13)) is the answer. To count only the customers in one region, filter first: =COUNTA(UNIQUE(FILTER(A2:A13,B2:B13=E4))).
In older versions use =SUMPRODUCT(1/COUNTIF(A2:A13,A2:A13)). COUNTIF counts how often each entry appears. Dividing 1 by that count gives each entry a share of 1 across its rows, so a value that appears three times contributes three thirds, which adds to 1. The total is the number of distinct values. It fails on blank cells, because a blank gives a division by zero.
Two cautions. Excel compares text without regard to case, so "Pine Dental" and "pine dental" count as one. And trailing spaces make entries different, so clean the list with TRIM when the count looks too high.
If you only need to eyeball the number, the PivotTable route works too: insert a PivotTable, drop the field into Rows, and count the items. The Analysis track builds up these patterns step by step.
=COUNTA(UNIQUE(A2:A13))
=SUMPRODUCT(1/COUNTIF(A2:A13,A2:A13))
Solve it in the sheet. Every answer is checked, with hints if you need them.
Task 1 of 2
In D2, count how many different customers appear in A2:A13.
Answer in D2.
Excel foundations covers this in lesson 7, COUNT and COUNTA.