Function Problems

Count Unique Values in Excel While Ignoring Duplicates

Natalie TaylorNatalie Taylor Nov 18, 2026 870 views

Question details

Count each distinct value once in an Excel range, even when values are repeated.

Count Unique Values in Excel While Ignoring Duplicates
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.
Before you start

Identify the range to count and check whether it contains blank cells. The examples use F3:F9; replace that range with your own.

Solution 1Recommended

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.

1
Select a result cell

Click an empty cell where you want the count to appear.

2
Enter the formula

Type =COUNTA(UNIQUE(F3:F9)) and press Enter. Replace F3:F9 with your source range.

Use UNIQUE and COUNTA in a modern version of Excel
Exclude blank cells: If the range contains blanks, use =IFERROR(ROWS(UNIQUE(FILTER(F3:F9,F3:F9<>""))),0) instead. IFERROR returns 0 when no nonblank values are found, but it can also hide other formula errors.
Count distinct entries in WPS Spreadsheets

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. 1. Open the workbook: Open your Excel workbook in WPS Spreadsheets and locate the list to count.
  2. 2. Copy the list: Select the source cells, copy them, and paste them into an empty column, such as H3:H9.
  3. 3. Remove duplicates: Select the copied cells, choose Data > Remove Duplicates, and confirm the column to remove repeated entries from the copy.
  4. 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.
Count distinct entries without changing the original listOpen and edit Microsoft Excel XLSX and XLS filesUse familiar spreadsheet tools and formulasGet started with WPS Office for free
microsoft office alternative - wps office

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.