The Excel COUNTIF function counts the cells in a range that meet a single condition — an exact match, a number comparison, or a wildcard text pattern.
Syntax
| Argument | Description | |
|---|---|---|
range | Required | The range of cells to test. |
criteria | Required | The condition — a number, text, expression like ">100", or a wildcard pattern like "East*". |
How to use it
COUNTIF tallies cells that satisfy one criterion. Comparison operators go inside quotes, and you can use the wildcards * (any characters) and ? (one character) for text.
To combine a comparison with a cell reference, concatenate with &: =COUNTIF(B2:B20, ">"&E1). For more than one condition, step up to COUNTIFS.
Criteria are case-insensitive. "east" and "EAST" match the same cells. Use wildcards for partial matches and & to splice in values from other cells.
Try it: interactive demo
Pick a COUNTIF example to see the formula and its result.
Practice workbook
Frequently asked questions
How do I write a greater-than condition?
=COUNTIF(B2:B20, ">100"). To compare against a cell, concatenate: =COUNTIF(B2:B20, ">"&E1).Is COUNTIF case-sensitive?
"east" matches East, EAST, and east alike. For case-sensitive counting you need a different approach such as SUMPRODUCT with EXACT.Can I use wildcards in COUNTIF?
* matches any number of characters and ? matches a single character. For example "East*" counts entries that start with East.How do I count with more than one condition?
COUNTIFS, which accepts multiple range/criteria pairs and counts rows that satisfy all of them.Master functions like this in one day
This page covers one function. Our Excel Formulas and Functions class covers the 30 that matter most — live, hands-on, taught by professionals in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.
See the Formulas & Functions Class