Count unique values among duplicates
To count unique values among duplicates in Excel, you have a few methods depending on your version of Excel.
β
1. Excel 365 / 2019+: Use UNIQUE() + COUNTA()
If your data is in column A (A2:A100):
=COUNTA(UNIQUE(A2:A100))
π’ This counts how many distinct values are in that range β duplicates are ignored.
β
2. Excel 2016 or earlier: Use SUMPRODUCT + COUNTIF
If you donβt have the UNIQUE function:
=SUMPRODUCT(1/COUNTIF(A2:A100, A2:A100))
This counts each distinct value once, even if it appears multiple times.
β οΈ Note: This array-style formula may return errors if there are blanks. Use this safer version:
=SUMPRODUCT((A2:A100<>"")/COUNTIF(A2:A100, A2:A100 & ""))
β 3. Count Unique Based on a Condition
Example: Column A = Names, Column B = Region
Count unique names only where Region = “North”
=SUM(--(FREQUENCY(IF(B2:B100="North", MATCH(A2:A100, A2:A100, 0)), ROW(A2:A100)-ROW(A2)+1)>0))
π Press Ctrl+Shift+Enter in older Excel (not needed in Excel 365).
β 4. Using Pivot Table (No Formula)
- Select your data.
- Go to Insert > PivotTable.
- Drag the column with duplicates into the Rows area.
- Any field into the Values area (or use “Count”).
- Youβll now see the list of unique items in the Rows area.