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.
Normally, the COUNTIFS function helps to return the number of cells that meet one or more criteria, the generic syntax is:
- 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:
1. The SUMPRODUCT function in Excel also can help to count cells that match multiple criteria, please apply the below formula:
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:
Relative function used:
- The COUNTIFS function returns the number of cells that meet one single criterion or multiple criteria.
- 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.