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


(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:



Personal Career & Learning Guide for Data Analyst, Data Engineer and Data Scientist

Applied Machine Learning & Data Science Projects and Coding Recipes for Beginners

A list of FREE programming examples together with eTutorials & eBooks @ SETScholars

95% Discount on “Projects & Recipes, tutorials, ebooks”

Projects and Coding Recipes, eTutorials and eBooks: The best All-in-One resources for Data Analyst, Data Scientist, Machine Learning Engineer and Software Developer

Topics included: Classification, Clustering, Regression, Forecasting, Algorithms, Data Structures, Data Analytics & Data Science, Deep Learning, Machine Learning, Programming Languages and Software Tools & Packages.
(Discount is valid for limited time only)

Disclaimer: The information and code presented within this recipe/tutorial is only for educational and coaching purposes for beginners and developers. Anyone can practice and apply the recipe/tutorial presented here, but the reader is taking full responsibility for his/her actions. The author (content curator) of this recipe (code / program) has made every effort to ensure the accuracy of the information was correct at time of publication. The author (content curator) does not assume and hereby disclaims any liability to any party for any loss, damage, or disruption caused by errors or omissions, whether such errors or omissions result from accident, negligence, or any other cause. The information presented here could also be found in public knowledge domains.

Learn by Coding: v-Tutorials on Applied Machine Learning and Data Science for Beginners

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!