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

=COUNTA(UNIQUE(FILTER(range,criteria)))

### Summary

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:

=COUNTA(UNIQUE(FILTER(B6:B15,C6:C15=H6)))

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

### Explanation

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:

{"Jim";"Jim";"Carl";"Sue";"Carl"}

Next, the UNIQUE function is used to remove duplicates:

UNIQUE({"Jim";"Jim";"Carl";"Sue";"Carl"})

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:

=COUNTA(UNIQUE(FILTER(B6:B15,(C6:C15=H6)*(B6:B15<>""))))

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:

=COUNTA(UNIQUE(FILTER(B6:B15,(C6:C15=H6)*(D6:D15="june"))))

#### Free Machine Learning & Data Science Coding Tutorials in Python & R for Beginners. Subscribe @ Western Australian Center for Applied Machine Learning & Data Science.

Western Australian Center for Applied Machine Learning & Data Science – Membership

## 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**