Count if
COUNTIF Function¶
The COUNTIF function in Excel is used to count the number of cells within a range that meet a single specified criterion. This function is useful for a variety of data analysis tasks where you need to count items based on specific conditions.
Syntax:¶
COUNTIF(range, criteria)
- range: The range of cells you want to apply the criteria to.
- criteria: The condition that will determine which cells to count. This can be a number, expression, cell reference, or text that defines which cells will be counted.
Examples:¶
=COUNTIF(A1:A10, ">5")would count the number of cells in the rangeA1:A10that contain numbers greater than 5.=COUNTIF(B1:B10, "Bananas")would count all the cells inB1:B10that contain the exact word "Bananas".=COUNTIF(C1:C10, D1)would count all the cells inC1:C10that match the content of cellD1.
Usage Notes:¶
- The
criteriacan include wildcards such as?(to represent any single character) and*(to represent any sequence of characters) when you want to match patterns. COUNTIFis case-insensitive, meaning it treats uppercase and lowercase letters as the same.- The function can be used for both numeric and text data, as well as for more complex criteria involving text strings, dates, and functions.
Note: For criteria that involve multiple conditions across different ranges, you would use the
COUNTIFSfunction, which is the plural version capable of handling multiple criteria.