Count Unique Values in Excel While Ignoring Duplicates
Question details
Count each distinct value once in an Excel range, even when values are repeated.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A range contains repeated entries, such as fruit names, and the user wants a count of the different values.
- Observed behavior
- The desired result counts each different value once rather than counting every occurrence.
Identify the range to count and check whether it contains blank cells. The examples use F3:F9; replace that range with your own.
Use UNIQUE and COUNTA in a modern version of Excel
Use this formula in Microsoft 365, Excel 2021 or later, or Excel for the web when the source range has no blanks.
Click an empty cell where you want the count to appear.
Type =COUNTA(UNIQUE(F3:F9)) and press Enter. Replace F3:F9 with your source range.

Use a COUNTIF array formula in older Excel versions
Use this method when UNIQUE is unavailable and every cell in the source range contains a value.
Count Unique Values With WPS Spreadsheets
Copy your list, remove duplicates from the copy, and count the remaining entries with COUNTA in WPS Spreadsheets.
- 1. Open the workbook: Open your Excel workbook in WPS Spreadsheets and locate the list to count.
- 2. Copy the list: Select the source cells, copy them, and paste them into an empty column, such as H3:H9.
- 3. Remove duplicates: Select the copied cells, choose Data > Remove Duplicates, and confirm the column to remove repeated entries from the copy.
- 4. Count the entries: Click an empty cell and enter =COUNTA(H3:H9), adjusting the range to match your copied list. Press Enter to count the remaining nonblank entries.

Frequently Asked Questions
Does UNIQUE count values that appear more than once?
Yes. UNIQUE returns each distinct value once, including values repeated in the source range. COUNTA then counts the returned values.
How can I exclude blank cells from the count?
In a modern version of Excel, use =IFERROR(ROWS(UNIQUE(FILTER(F3:F9,F3:F9<>""))),0) and replace F3:F9 with your range.
Why does my older Excel formula show a division error?
The formula =SUM(1/COUNTIF(F3:F9,F3:F9)) can produce a division error when the range contains blanks. Select a range without blank cells and confirm the formula with Ctrl+Shift+Enter.
Will removing duplicates change my original data?
The Remove Duplicates command changes the selected cells. To keep the original list intact, copy it to an empty column first and run Data > Remove Duplicates on the copy.




