

How to count numbers between 2 specified numbersīy and large, COUNTIFS formulas for numbers fall into 2 categories - based on several conditions (explained in the above examples) and between the two values you specify. You can find a few more ways to count cells with OR logic in this tutorial: Excel COUNTIF and COUNTIFS with OR conditions. To get the total count, embed COUNTIFS inside the SUM function, like this: To perform the same calculations in a more compact formula, list all of your criteria in an array constant, and supply that array to the criteria argument of the COUNTIFS function. In situations when you have to evaluate a lot of criteria, the above approach is not the best way to go because your formula would grow too big in size. For example, to get the count of " Cancelled" and " Pending" orders for " Apples" use this formula: In case each of the functions is supposed to evaluate more than one condition, use COUNTIFS instead of COUNTIF. To have it doen, you can simply write 2 regular Countif formulas and add up the results: In the table below, supposing you want to count orders with the " Cancelled" and " Pending" status. Add up two or more COUNTIF or COUNITFS formulas based on the OR logic? Overall, there are two ways to do this - by adding up several COUNTIF formulas or using a SUM COUNTIFS formula with an array constant. How to count cells with multiple criteria (OR logic)Īs you have seen in the above examples, counting cells that meet all of the specified criteria is easy because the COUNTIFS function is designed to work this way.īut what if you want to count cells for which at least one of the specified conditions is TRUE, i.e.

Using a simpler formula with a single criteria_range like COUNTIFS(B2:C7,"=0") would yield a different result - the total count of cells in the range B2:C7 containing a zero (which is 4 in this example). This COUNTIFS formula returns 1 because only " Grapes" have "0" value in both columns. When you want to count items with identical criteria, you still need to supply each criteria_range / criteria pair individually.įor example, here's the right formula to count items that have 0 both in column B and column C: The criteria defines which cells shall be counted and can be expressed as 10, "0", C2:C7,"=0")Īnd the count is 2 (" Cherries" and " Lemons"):įormula 2.


The difference is that COUNTIF is designed for counting cells with a single condition in one range, whereas COUNTIFS can evaluate different criteria in the same or in different ranges. Of all Excel functions, COUNTIFS and COUNTIF are probably most often mixed up because they look very much alike and both are purposed for counting cells based on the specified criteria. You will find a number of examples for different data types - numbers, dates, text, wildcard characters, non-blank cells and more. The tutorial explains how to use COUNTIFS and COUNTIF formulas with multiple criteria in Excel based on AND as well as OR logic.
