The COUNTIFS function in Excel is a powerful tool designed to count the number of cells that meet specific criteria across multiple ranges. Unlike the basic COUNT function, which counts all numeric entries within a range, COUNTIFS allows users to apply multiple conditions, making it a versatile choice for data analysis and reporting.
Syntax
COUNTIFS(criteria_range1, criteria1, [criteria_range2, criteria2], ...)
- criteria_range1: The first range of cells to evaluate against the associated criteria.
- criteria1: The condition that the cells in criteria_range1 must meet to be counted.
- criteria_range2, criteria2: Additional ranges and their corresponding criteria (optional, can be extended for more conditions).
Example #1
=COUNTIFS(A1:A10, ">=10", B1:B10, "<20")
This function counts the number of entries in the range A1:A10 that are greater than or equal to 10, and in the corresponding B1:B10 range, are less than 20. If A1:A10 contains {12, 10, 15, 22, 9} and B1:B10 contains {5, 12, 8, 15, 17}, the result is 1.
Example #2
=COUNTIFS(C1:C10, "Apples", D1:D10, "><=5")
Here, the function counts how many times "Apples" appears in range C1:C10, with a corresponding value of 5 or less in D1:D10. Given C1:C10 as {"Bananas", "Apples", "Apples", "Oranges", "Apples"} and D1:D10 as {3, 5, 2, 8, 4}, the function returns 3.
Example #3
=COUNTIFS(E1:E10, "Yes", F1:F10, "<>10")
This instance counts how many cells in E1:E10 have "Yes", while the corresponding F1:F10 values are not equal to 10. If E1:E10 is {"Yes", "No", "Yes", "Yes", "No"} and F1:F10 is {12, 5, 9, 10, 7}, the result would be 2.
Error handling
- VALUE!: Occurs when one of the criteria ranges is non-numeric or improperly formatted.
- NAME?: Indicates that the function name is not recognized, often due to a typo in the formula.
- NUM!: This error may arise when criteria are set to impossible values or if the range specified is invalid.