Search Authority

Count Unique Values in Excel with COUNTIF (Easy Guide)

When you need to count unique values in Excel, you are often working with lists of names, product IDs, or transaction entries where duplicates obscure the true count. This artic...

Mara Ellison Jul 25, 2026
Count Unique Values in Excel with COUNTIF (Easy Guide)

When you need to count unique values in Excel, you are often working with lists of names, product IDs, or transaction entries where duplicates obscure the true count. This article walks through reliable techniques to identify and count distinct entries using formulas and tools built into Excel.

Use the structured guidance below to choose the right method based on your data shape and your accuracy needs.

Method When to Use Key Formula or Tool Pros
Combined SUMPRODUCT and COUNTIF Entire column or list with text or numbers =SUMPRODUCT(1/COUNTIF(range, range)) Works without helper columns, fast for moderate data
Remove Duplicates feature You want a clean list of unique items Data tab > Remove Duplicates Simple UI, instantly shows unique rows
Advanced Filter to extract unique values Need a list of unique values in another location Data tab > Advanced filter > Unique records only Keeps original data intact, outputs distinct list
UNIQUE function (Excel 365 and Excel 2021) Dynamic arrays available =UNIQUE(range) Live spill results, easy to count with COUNTA

Understanding Countif for Unique Values

Countif unique values in Excel becomes powerful when you combine it with other functions to handle repeats in denominators. The classic formula uses 1 divided by the count of each item to weight duplicates properly, so each distinct value only contributes one to the final total.

This approach shines when your data has repeated entries but you need to know how many different items exist. You can apply it to text labels, product codes, or customer identifiers without manually filtering first.

Place your data in a single column without blank cells to keep the calculation predictable, and test on a small range before scaling to entire columns.

Using Sumproduct With Countif

Pairing SUMPRODUCT with COUNTIF is one of the most common ways to count unique values because it handles both numbers and text reliably. The inner COUNTIF produces an array of frequencies, and SUMPRODUCT adds the reciprocals of those frequencies.

For example, if your list is in A2:A100, the formula equals SUMPRODUCT(1/COUNTIF(A2:A100, A2:A100)). This delivers the distinct count in a single cell, even when you later add new rows to the range.

Wrap the formula in IFERROR to guard against division errors caused by blank cells, such as =SUMPRODUCT(IFERROR(1/COUNTIF(A2:A100, A2:A100), 0)).

Removing Duplicates to Confirm Unique Count

Excel’s Remove Duplicates feature gives you a quick visual check of how many unique values exist. By creating a copy of your column and removing repeats, you can count the remaining rows to verify formula results.

Select the data, go to Data tab, click Remove Duplicates, and choose the relevant column. Excel reports how many unique records remain, which helps you cross-validate your Countif-based calculations.

Use this method when you also need a clean list of unique items for reporting or further analysis, rather than only a count.

Advanced Filter for Unique Lists

The Advanced Filter provides a middle ground between formulas and manual work by extracting unique values to a new location. You specify the list range, enable the Unique records only option, and direct the output to a blank area on the sheet.

This technique is helpful when you want to inspect the actual distinct items and then count them with COUNTA. It also supports multi-column uniqueness when you select multiple fields in the dialog.

Keep your criteria range empty to extract all unique combinations, and remember to update the filter if the source data changes significantly.

Key Takeaways for Countif Unique Values

  • Verify your data has no unintended blank cells that can distort reciprocal calculations.
  • Use SUMPRODUCT with 1/COUNTIF for a compact formula that works across text and numbers.
  • Leverage Remove Duplicates or Advanced Filter to visually confirm distinct counts.
  • Consider UNIQUE in modern Excel for dynamic, spill-based distinct lists and counts.
  • Combine techniques and cross-check results to ensure accuracy for critical reports.

FAQ

Reader questions

How do I count unique text values only, ignoring numbers in the range?

Use a formula that combines SUMPRODUCT, ISTEXT, and COUNTIF to restrict the calculation to text entries while still weighting duplicates correctly.

Can I count unique values based on a condition in another column?

Yes, wrap the Countif logic inside SUMPRODUCT with additional criteria ranges, such as counting distinct names only for a specific region or status.

What do I do if my formula returns a divide by zero error?

Wrap the core expression in IFERROR or add a helper column to remove blanks before applying the count reciprocal method to avoid division errors.

Will the UNIQUE function work in my version of Excel?

Check your build number; the UNIQUE function is available in Excel for Microsoft 365 and Excel 2021, and requires a subscription or recent purchase.

Related Reading

More pages in this topic cluster.

How to Tell the Difference Between Silver and Aluminum (Silver vs Aluminum)

Spotting the difference between silver and aluminum helps you verify purchases, appraise items, and avoid overpaying for misidentified metals. While they look similar at first g...

Read next
Excel Keyboard Shortcut for Strikethrough: Easy Step-by-Step Guide

Mastering the Excel keyboard shortcut for strikethrough helps you track completed tasks, revisions, and action items without leaving the keyboard. This small efficiency habit sp...

Read next
Durham NC News Today: Latest Headlines & Updates

Durham NC news keeps the Research Triangle region informed about breakthrough healthcare, education, and downtown development. Local reporting connects residents and visitors to...

Read next