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.
In this example, the goal is to count test scores in column C that are less than 75. The simplest way to do this is with the COUNTIF function , which takes two arguments , range and criteria : = COUNTIF ( range , criteria ) The test scores in the...
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...
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.