How to Use COUNTIF with UNIQUE in Google Sheets

Welcome to the ultimate guide on using COUNTIF with UNIQUE in Google Sheets! If you’ve ever struggled with counting values based on unique criteria in Google Sheets, then this article is for you. We’ll explore both the single-column approach and the multi-column approach, so let’s dive right in.

The Single-Column Approach

When you want to count a column based on the unique values in another column, the COUNTIF function alone won’t do the trick. But don’t worry, we have a solution – the Query formula for multi-column Unique COUNTIFs. Let’s get started!

To understand the concept better, let’s look at some sample data. In this example, we want to count the number of receipts for each fruit, which are listed in column A. To count the receipts of a single item, you can use the following Countif formula:

=COUNTIF(A2:A8,"APPLE")

This formula would output the result as 5, which is the number of receipts for apples. But what if we want something different?

What if we want to apply the UNIQUE function to column A and then use COUNTIF with it? The expected result would be a count of unique receipts for each fruit. Here’s the formula to achieve this:

{UNIQUE(A2:A8),ARRAYFORMULA(COUNTIF(A2:A8,UNIQUE(A2:A8)))}

This formula combines two arrays using Curly Brackets. The first part of the formula, UNIQUE(A2:A8), returns the unique fruits from column A. The second part, ARRAYFORMULA(COUNTIF(A2:A8,UNIQUE(A2:A8))), counts the unique fruits. Finally, the curly brackets output both arrays together as a single array.

If you prefer using the Query formula, here’s an equivalent formula for the above:

=QUERY(A:C,"SELECT A, COUNT(B) WHERE A <> '' GROUP BY A ORDER BY COUNT(B) DESC LABEL COUNT(B) 'TOTAL'",1)

Keep in mind that the above formula is for the single-column approach. For multi-column conditional counting, it’s recommended to use the Countifs formula.

The Countifs Based on Unique Values

Now, let’s explore counting based on unique values in multiple columns. In this example, let’s count the number of present days for each student by checking column C if it equals “Y.” Here’s the Query formula and the expected result:

Counting Unique Values in Google Sheets

Conclusion

Congratulations! You’ve learned how to effectively use COUNTIF with UNIQUE in Google Sheets for both single-column and multi-column approaches. To enhance your learning experience, we recommend creating sample data in a blank sheet and practicing the formulas yourself. Typing the formulas directly in your Sheets is also a good practice to avoid any issues with copied formulas. Now go ahead and explore the endless possibilities of COUNTIF with UNIQUE in Google Sheets!

Visit Crawlan.com to discover more amazing SEO tips and tricks for your Google Sheets adventures. Happy counting!

Related posts