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.
Syntax =COUNTIFS(criteria_range1, criteria1, ...)
=COUNTIFS(A2:A6,"TX",B2:B6,">=100")Arguments
| Name | Required | What to pass |
|---|---|---|
| criteria_range1 | Required | The first column to test. |
| criteria1 | Required | The test for that column. |
| criteria_range2, criteria2, … | Optional | More 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
| A | B | |
|---|---|---|
| 1 | State | Amount |
| 2 | TX | 120 |
| 3 | CA | 80 |
| 4 | TX | 40 |
| 5 | NY | 200 |
| 6 | TX | 90 |
| 7 | TX and >= 100 | 2 |
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.