Home > Formulas > Count > Criteria Count with Column CriteriaHow to count items in one worksheet column, based on values in a different column. For example, count all orders with a note in Problem column, but only if Region is "East", using Excel COUNTIFS function. 
Excel COUNTIFS FunctionIn Microsoft Excel 2007 and later versions, you can use the COUNTIFS function to count rows that meet two or more criteria. COUNTIFS ArgumentsWith the COUNTIFS function syntax, there are 2 required arguments:
Optional Criteria ArgumentsIf needed, you can add more pairs of criteria ranges and criteria in the COUNTIFS function. For example,
In the screen shot below, the criteria_range2 argument is highlighted. The square bracket indicates that the argument is optional Criteria Range RulesWhen adding each set of criteria range and criteria in the COUNTIFS function, you must follow these two rules:

COUNTIFS  Text and NumbersThis short video shows how to count items that have specific text in one column, and numbers over a set amount in a different column. The formula uses the COUNTIFS function, available in Excel 2007 and later. There are written steps below the video, and a full transcript for the video is at the end of this page. Count with Multiple Criteria  Text and NumbersIn this example only the rows where the item is "Pen" and the quantity is greater than or equal to ten will be counted.
The result shows the number of rows that meet the criteria Note: Instead of typing the criterion in a formula, you can refer to a cell, as shown in the second formula below. If using operators, enclose them in double quote marks. Use typed criteria, to get the count of cells:
or cell references:

Count Text and Not BlankIn this example, there is a list of orders, and we want to count the orders, based on 2 criteria, stored in two different columns:
In the screen shot below, the orders in rows 2 and 9 meet both of the criteria: COUNTIFS FormulaTo get the count of problem orders in the East, enter this formula in cell F5: =COUNTIFS(B2:B11,F2,D2:D11,”<>”) The formula result is 2, and it uses two sets of arguments to get the total count:
NOTE: The criterion “<>” is the “not equal to” operator. Used alone it means “not equal to ‘no text'”, so it will count cells that are not empty. That formula result matches the manual count that we did earlier. Note: Count Blank or Empty StringIn the Region/Problem example, a few notes were typed in the Problem column, and the remaining cells were empty. Our formula only counts the cells that are not empty. However, if column D contained formulas, and some cells had a result of "" (an empty string), those cells would be also counted as “not empty”, just like the cells that contain text, even though they look blank. Be sure that your blank cells are really empty, if you’re going to use this formula. If not, instead of COUNTIFS, you could use a SUMPRODUCT formula, like this one:
NOTE: Those are two minus signs (double unary) before each section of the SUMPRODUCT formula, not long dashes. 
Multiple Criteria in One ColumnIn the above formulas, the criteria that you want to count are in 2 different columns, like the "Pen" and "Quantity" example above. However, for some data, you might need to check the same column multiple times, like the example in the video below. This video shows how to use the COUNTIFS function to count cells based on a range of numbers. In this video, the minimum and maximum numbers are entered on the worksheet. In cell E6, a COUNTIFS formula counts the number of cells, in column B, that meet both of the following criteria
Here is the formula in cell E6:
Note: There is a full transcript available to read, below the video. Video TranscriptIf you'd like to read the video transcript, click on the green check box below. When you're finished, you can click the check box again, to hide the transcript Video Transcript: Count Numbers in a RangeIn Excel 2003 and earlier versions, if you want to count things based on criteria you can use COUNTIF In Excel 2007 and later versions, there's also a new function called COUNTIFS and with this you can do some things a little more easily. So, if we wanted to count items that have quantity that's between 5 and 10, in the old version we had to combine two different COUNTIFs Start the FormulaTo get our answer with COUNTIFS, we create one formula, and we can put different sets of ranges and criteria We can have up to 127 of those combinations, so we get quite a bit of flexibility. In this case, we've got COUNTIFS, where we're looking at this range of cells, and saying, I want:
So we've combined the two criteria And when we press Enter, we get 6 as a result Add More CriteriaWe can add more criteria as well, and in this case, we could look for items where there's a pen in the order. So I've added another set of criteria, so the third set is looking at range A2 to A10, and finding items where there's a pen. And when we press Enter, there are only 2 now, where
Use WildcardsYou can also use wildcards, and in this formula, instead of just typing "pen", we typed "pen*", with an asterisk. So we get anything that starts with "pen" So now there are 4, because we're getting "pen" and "pencil" items, where the quantity is between 5 and 10 
COUNTIFS Function WarningsThere are a few things to be careful with, when using the COUNTIFS function:
7 Ways to Count in ExcelIn addition to COUNTIFS, there are many other ways to count in Excel. To see a quick overview of 7 ways to count in Excel, watch this short video. And get the 7 Ways to Count sample workbook, so you can follow along with the video. Also, tThere are more counting formula examples and sample files on the Excel Count Functions page. 
Change Operator for COUNTIFS FunctionInstead of typing the operator into the COUNTIFS formula, as shown above, you can create a list of all possible operators, and select one from a drop down list. Then, refer to that operator in the formula. This video shows the steps for setting up the formula, and the written instructions are on the Excel Count Functions page. The example in the video uses COUNTIF, and you can follow the same steps to set up the drop down list of operators for the COUNTIFS function. 
Video Transcript: Text and Number CriteriaThis is the full transcript for the video, "Count Based on Text and Number Criteria", shown above on this page.  In Excel, you can count using criteria with the COUNTIF function. In later versions of Excel, 2007 and later, you can count multiple criteria with the COUNTIFS function. Here we have the list of items that we've sold, and the quantity for each. We would like to find the number of orders where a pen was the item sold, and the quantity is greater than 10. Start the FormulaIn this cell, I'm going to start with an equal sign, and then type COUNTIFS, and open bracket The first thing I'm going to check is the item that was sold. The range, the first range is A2 to A10. Then I'll type a comma, and the criteria for that range, I'm just going to type in here, inside double quotes, pen, and then another comma. So that's the first thing we're going to check is what item was sold. Add 2nd CriteriaAnd the next will be the quantity. I'll select the range that has the quantities, another comma. We want quantity greater than, or equal to 10, so within double quotes I'll do a greater than symbol, equal, and a 10. Then another double quote, close the bracket and press Enter. There were 2 orders for pen, where the quantity is greater than 10. Refer to Worksheet CellInstead of typing these criteria in here, I can refer to a cell. So instead of typing pen, inside double quotes, I could click on a cell where I have typed the word pen. The same for this criteria, for the quantity. I'm going to take out the 10, just by deleting that, leaving the operators within the double quotes. Then I'll type an ampersand, and the cell that has the number. So this is greater than or equal to whatever number is in cell E3. Change Criteria on WorksheetWhen I press Enter, I get the same result, but it's just easier to change then. I could type a 5 here now, and we see that there were 4 orders where the quantity is greater than or equal to 5, instead of the 10 that we had in there before. So this formula is much more flexible if you use cell references, rather than typing the values in as hard coded values. 
Get the COUNT Sample Files
More Function Tutorials 
Last updated: October 26, 2022 8:52 PM