COUNTIF counts the number of cells in a range that match the supplied criteria. In this case, the criteria for the first COUNTIF is "apples" and the criteria for the second COUNTIF is "pears". The first COUNTIF returns the count of cells in B4:B9 equal to "apples". The second COUNTIF returns the count of cells in B4:B9 equal to "pears". These two counts are added together and the sum is returned as the result of the formula.
Note that text values in the criteria for COUNTIF need to be enclosed in quotes (""). Also note that COUNTIF is not not case sensitive. In the example, the words "apples" and "pears" in any combination of upper and lower case letters will be counted.
If you are counting cells that contain a numeric value, there is no need to add quotes around the numbers. For example, if in the above example you wanted to count cells that contain zero or 1, the formula is:
To count the number of cells that 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 contain, and "*" is a wildcard matching any...
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 (>,...
Excel Formula Training
Learn Excel formulas and functions with concise, clear videos. Master absolute/relative addresses, dates, text, named ranges, and tools for troubleshooting. Each video comes with a practice worksheet and audio transcript. Instant access and complete 100% guarantee. Start today!