Function · Statistical

Excel COUNTIFS function

The Excel COUNTIFS function counts rows that pass every test. Two Texas orders of at least $100, out of five.

Excel 2007 and later. Also in Excel for the web and Google Sheets.

Syntax =COUNTIFS(criteria_range1, criteria1, ...)

COUNTIFS
=COUNTIFS(A2:A6,"TX",B2:B6,">=100")

Arguments

NameRequiredWhat to pass
criteria_range1RequiredThe first column to test.
criteria1RequiredThe test for that column.
criteria_range2, criteria2, …OptionalMore pairs. A row counts only when every pair passes. Ranges must be the same size.

Examples

Texas orders of at least $100

=COUNTIFS(A2:A6,"TX",B2:B6,">=100")

Result 2

=COUNTIFS(A2:A6,"TX",B2:B6,">=100")B7
Orders
AB
1StateAmount
2TX120
3CA80
4TX40
5NY200
6TX90
7TX and >= 1002
A picture of the sheet, not a live calculator. $120 and $90 are the Texas rows at or above $100. $40 is Texas and too small.

COUNTIFS counts a row only when every test is true. Of the five orders, the Texas amounts are $120, $40, and $90. The ones at or above $100 are $120 and $90, so the count is 2. New York’s $200 fails the state test. Texas’s $40 fails the amount test.

The tests are combined with AND. “Texas or California” is two COUNTIFS added together. Comparisons go in quotes, the same way as COUNTIF. Pair this with SUMIFS when you need both the count and the dollars.