COUNTIF Function

Excel Functions › Statistical

Excel 2007+ Statistical

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.


Quick answer:
=COUNTIF(B2:B20,">100") how many values are over 100

Syntax

=COUNTIF(range, criteria)
ArgumentDescription
rangeRequiredThe range of cells to test.
criteriaRequiredThe 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.

=COUNTIF(B2:B20, ">100") // values over 100
=COUNTIF(A2:A20, "East") // exact text match
=COUNTIF(A2:A20, "East*") // starts with East

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

Live demo

Pick a COUNTIF example to see the formula and its result.

Result:

Practice workbook

📊
Download the free COUNTIF practice workbook
Every example on this page, ready to open in Excel — plus practice challenges with answers on a separate tab. No sign-up required.

Frequently asked questions

How do I write a greater-than condition?
Put the operator and value in quotes: =COUNTIF(B2:B20, ">100"). To compare against a cell, concatenate: =COUNTIF(B2:B20, ">"&E1).
Is COUNTIF case-sensitive?
No. Text criteria are case-insensitive, so "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?
Yes — * 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?
Use 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

Related functions: COUNTIFS · COUNT · COUNTA · SUMIF · AVERAGEIF · COUNTBLANK