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.
To count the number of cells that contain values less than a particular number, you can use the COUNTIF function. In the generic form of the formula (above) rng represents a range of cells that contain numbers, and X represents the boundary below...
To count the number of cells that do not contain certain text, you can use the COUNTIF function. In the generic form of the formula (above), rng is a range of cells, txt represents the text that cells should not contain, and "*" is a wildcard...
COUNTIF is a function to count cells that meet a single criteria. COUNTIF can be used to count cells with dates, numbers, and text that match specific criteria. The COUNTIF function supports logical operators (>,...
The Excel INDIRECT function returns a valid reference from a given text string. Use INDIRECT when you need to convert a reference assembled as text into a proper 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.