Count cells that match two or more criteria in Excel

In Excel, to count the number of cells based on two or multiple criteria, the COUNTIFS function may help you to solve this task quickly and easily.

Supposing, you have a product list as below screenshot shown, now, you want to count the number of the product T-shirt which Qty is greater than 30, this article will talk about how to use the COUNTIFS function for dealing with this job in Excel.

Count cells that match two or more criteria with COUNTIFS function

Count cells that match two or more criteria with COUNTIFS function

Normally, the COUNTIFS function helps to return the number of cells that meet one or more criteria, the generic syntax is:

=COUNTIFS(criteria_range1,critera1, criteria_range2,critera2…)
• criteria_range1: The first range for which you want to evaluate against criteria1;
• critera1: The first criteria that define which cells to be counted;
• criteria_range2: The second range for which you want to evaluate against criteria2;
• critera2: The second criteria that define which cells to be counted.

To get the number of cells based on two given conditions, please apply the below formula into a blank cell, and press Enter key to get the result:

=COUNTIFS(A2:A12,"T-shirt",D2:D12,">30")

Tips:

1. The SUMPRODUCT function in Excel also can help to count cells that match multiple criteria, please apply the below formula:

=SUMPRODUCT((A2:A12="T-shirt")*(D2:D12>30))

2. For dealing with more criteria, you just need to add other range, criteria pairs within the COUNTIFS or SUMPRODUCT function. For example, to count number of the product T-shirt which size is Medium and Qty is greater than 30, you should apply any one of the following formulas:

=COUNTIFS(A2:A12,"T-shirt",B2:B12,"Medium",D2:D12,">30")
=SUMPRODUCT((A2:A12="T-shirt")*(B2:B12="Medium")*(D2:D12>30))

Relative function used:

• COUNTIFS:
• The COUNTIFS function returns the number of cells that meet one single criterion or multiple criteria.

More articles:

• Count matches between two columns in Excel
• For example, I have two lists of data in column A and column C, now, I want to compare the two columns and count if the value in column A found in column C in the same row as below screenshot shown. In this case, the SUMPRODUCT function may be the best function for you to solve this task in Excel.
• Count rows if meet internal criteria in Excel
• Supposing, you have a report of product sales of this year and last year, and now, you may need to count products where the sales in this year are greater than last year, or the sales in this year are less than last year as below screenshot shown. Normally, you can add a helper column for calculating the sale difference between the two years, and then use COUNTIF to get result. But, this article, I will introduce the SUMPRODUCT function to get the result directly without any helper column.
• Count rows if meet multiple criteria in Excel
• Count the number of rows in a range based on multiple criteria, some of which depends on the logical tests that work at the row-level, the SUMPRODUCT function in Excel may do you a favor.

The Best Office Productivity Tools

Kutools for Excel - Helps You To Stand Out From Crowd

Would you like to complete your daily work quickly and perfectly? Kutools for Excel brings 300 powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) and save 80% time for you.

• Designed for 1500 work scenarios, helps you solve 80% Excel problems.
• Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands.
• Become an Excel expert in 3 minutes. No longer need to remember any painful formulas and VBA codes.
• 30-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years.

Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)

• One second to switch between dozens of open documents!
• Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
• Increases your productivity by 50% when viewing and editing multiple documents.
• Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Firefox, And New Internet Explorer.