The result is 9 since there are 6 orders that are complete and 3 orders that are pending.

### COUNTIFS function

The COUNTIFS function returns the count of cells that meet one or more criteria, and supports logical operators (>,<,<>,=) and wildcards (*,?) for partial matching. Conditions are supplied to COUNTIFS in the form of range/criteria pairs — each pair contains one range and the associated criteria for that range: Count cells in range1 that meet criteria1. By default, the COUNTIFS function applies AND logic. When you supply multiple conditions, ALL conditions must match in order to generate a count: Count where range1 meets criteria1 AND range1 meets criteria2. This means if we try to user COUNTIFS like this: The result is zero, since the order status in column D can’t be both “complete” and “pending” at the same time. One solution is to supply multiple criteria in an array constant like this: This will cause COUNTIFS to return two results: a count for “complete” and a count for “pending” in array like this: In the current version of Excel, these results will spill onto the worksheet into two cells. To get a final total in one formula, we nest the COUNTIFS formula inside the SUM function like this: COUNTIFS returns the counts directly to SUM: And the SUM function returns the sum of the array as a final result. Note: this is an array formula but it doesn’t require special handling in Legacy Excel when using an array constant as above. If you use a cell reference for criteria instead of an array constant, you will need to enter the formula with Control + Shift + Enter in Legacy Excel.

### Adding another OR criteria

You can add one additional criteria to this formula, but you’ll need to use a single column array for criteria1 and a single row array for criteria2. So, for example, to count orders that are “Complete” or “Pending”, for “Andy Garcia” or “Bob Jones”, you can use: Note we use a comma in the first array constant for a horizontal array and a semicolon for the second array constant for a vertical array. With this configuration, Excel “pairs” elements in the two array constants, and returns counts in a two dimensional array like this The array result from COUNTIFS is returned directly to the SUM function: And SUM returns the final result, which is 3 in this case. Note: this technique will only handle two range/criteria pairs. If you have more than two criteria, consider a SUMPRODUCT formula as described here.

### Cell reference for criteria

As mentioned above, you can use a cell reference for criteria in an array formula like this: Where range is the criteria range, and B1:B2 is an example cell reference that contains criteria. This formula “just works” in the current version of Excel, which supports dynamic array formulas. However, in Legacy Excel, the formula must be entered with Control + Shift + Enter.

### Wildcards and double-counting

COUNTIF and COUNTIFS support wildcards, but you need to be careful not to double-count when you have multiple “contains” conditions with OR logic. See this example for more information

### Dave Bruns

Hi - I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.