COUNTIF counts the number of cells in a range that meet given criteria. If you try to use COUNTIF with multiple ranges separated by commas, you'll get an error. One solution is to write out the ranges as text in an array constant inside the INDIRECT function like this:
INDIRECT will evaluate the text values and pass the multiple ranges into COUNTIF. Because COUNTIF receives more than one range, it will return more than one result in an array. We use the SUM function to "catch" and handle the array:
With a limited number of ranges, this approach may be easier to implement. It avoids possible performance impacts of INDIRECT, and allows a normal formula syntax for ranges, so ranges will update automatically with worksheet changes.
Single cell ranges
With single cell ranges, you can write a formula without COUNTIF like this:
Each expression returns TRUE or FALSE, when are coerced to 1 and zero during the math operation. This is an example of using boolean logic in a formula.
COUNTIF counts the number of cells in the range that contain numeric values less than X and returns the result as a number. If you want to count cells that are "less than or equal to 80", use: = COUNTIF ( C5:C11 , "<=80" ) If you want...
COUNTIF counts the number of cells in the range that do not contain "a" by matching the content of each cell against the pattern " *a*", which is supplied as the criteria. The "*" symbol (the asterisk) is a wildcard in Excel that means "match any...
COUNTIF is an Excel function to count cells in a range that meet a single condition. COUNTIF can be used to count cells that contain dates, numbers, and text. The criteria used in COUNTIF supports logical...
The Excel INDIRECT function returns a valid reference from a given text string. INDIRECT is useful when you want to convert a text value into a valid cell reference.
Excel Formula Training
Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.