Excel formula for Beginners – How to Count unique values with criteria in Excel

Hits: 34


(Excel examples for Beginners)

In this end-to-end excel example, you will learn – Excel formula for Beginners – How to find Unique values by count in Excel.


Excel formula for Beginners – How to Count unique values with criteria in Excel


Generic formula



To count unique values with one or more conditions, you can use the COUNTA function together with UNIQUE and FILTER. In the example shown, the formula in H7 is:


which returns 3, since there are three unique names in B6:B15 associated with the Omega project.


At the core, this formula uses the UNIQUE function to extract unique values and the COUNTA function to count these values. The FILTER function is used to apply criteria.

Working from the inside out, FILTER is used to extract only names that are associated with the Omega project:

FILTER(B6:B15,C6:C15=H6) // Omega names only

This results in an array of results like this:


Next, the UNIQUE function is used to remove duplicates:


which results in a new array like this:

{"Jim";"Carl";"Sue"} // after UNIQUE

This array is delivered directly to the COUNTA function, which returns a count of all items in the array:

=COUNTA({"Jim";"Carl";"Sue"}) // returns 3

Unlike the COUNT function, which counts only numbers, COUNTA counts both text and numbers. Since there are three items in array, COUNTA returns 3. This formula is dynamic and will recalculate immediately if source data is changed.

Count unique ignore blanks

Blank cells in the name column can cause the unique count to increase because FILTER will include the empty value in the array delivered to the UNIQUE function. To ignore blank or empty cells in column B, you can adjust the formula above like this:


This is an example of using boolean logic to apply more than one condition. The approach is explained in more detail here.

Count unique with multiple criteria

To count unique values based on multiple criteria, can extend the “include” logic inside FILTER. For example, to count unique names for the Omega project in June only, use:




Sign up to get end-to-end “Learn By Coding” example.



Introduction to Applied Machine Learning & Data Science for Beginners, Business Analysts, Students, Researchers and Freelancers with Python & R Codes @ Western Australian Center for Applied Machine Learning & Data Science (WACAMLDS) !!!

Latest end-to-end Learn by Coding Projects (Jupyter Notebooks) in Python and R:

Applied Statistics with R for Beginners and Business Professionals

Data Science and Machine Learning Projects in Python: Tabular Data Analytics

Data Science and Machine Learning Projects in R: Tabular Data Analytics

Python Machine Learning & Data Science Recipes: Learn by Coding

R Machine Learning & Data Science Recipes: Learn by Coding


There are 2000+ End-to-End Python & R Notebooks are available to build Professional Portfolio as a Data Scientist and/or Machine Learning Specialist. All Notebooks are only $19.95. We would like to request you to have a look at the website for FREE the end-to-end notebooks, and then decide whether you would like to purchase or not.

Please do not waste your valuable time by watching videos, rather use end-to-end (Python and R) recipes from Professional Data Scientists to practice coding, and land the most demandable jobs in the fields of Predictive analytics & AI (Machine Learning and Data Science).

The objective is to guide the developers & analysts to “Learn how to Code” for Applied AI using end-to-end coding solutions, and unlock the world of opportunities!