- Advanced Excel Functions Tutorial
- Advanced Excel Functions - Home
- Compatibility Functions
- Advanced Excel Functions - Cube
- Database Functions
- Date & Time Functions
- Engineering Functions
- Financial Functions
- Information Functions
- Advanced Excel Functions - Logical
- Lookup & Reference Functions
- Math & Trignometric Functions
- Statistical Functions
- Useful Resources
- Quick Guide
- Useful Resources
- Discussion
Statistical - COUNTIF Function
Description
The COUNTIF function counts the number of cells that meet a criterion.
Syntax
COUNTIF (range, criteria)
Arguments
Argument | Description | Required/ Optional |
---|---|---|
range |
The group of cells you want to count. Range can contain numbers, arrays, a named range, or references that contain numbers. Blank and text values are ignored. |
Required |
criteria | A number, expression, cell reference, or text string that determines which cells will be counted. | Required |
Notes
Criteria are not case sensitive. E.g. the string "apples" and the string "APPLES" will match the same cells.
Wildcard characters the question mark (?) and asterisk (*) can be used in criteria. A question mark matches any single character. An asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) in front of the character.
When counting text values, make sure the data doesn't contain leading spaces, trailing spaces, inconsistent use of straight and curly quotation marks, or nonprinting characters. In these cases, COUNTIF might return an unexpected value.
COUNTIF supports named ranges. The named range can be in the current Worksheet, another Worksheet in the same Workbook, or from a different Workbook. To reference from another Workbook, that second Workbook also must be open.
COUNTIF uses only a single criteria. Use COUNTIFS to use multiple criteria.
If the specified criteria argument is a text string that is greater than 255 characters in length, COUNTIF returns #VALUE! Error value.
Applicability
Excel 2007, Excel 2010, Excel 2013, Excel 2016