Conditional sums and counts
COUNTIFS function playground
Counts the rows that meet several conditions at once.
The playground runs in your browser. Nothing you type is sent anywhere.
How COUNTIFS works
COUNTIFS lines up the ranges row by row. A row is counted only when it passes every condition.
All the ranges must be the same size. Put two conditions on the same column to count values between two limits.
Syntax
=COUNTIFS(criteria_range1, criteria1, [criteria_range2, criteria2], ...)| Argument | What it means |
|---|---|
criteria_range1required | The first range to test. |
criteria1required | The condition for that range. |
criteria_range2, criteria2, ...optional | More pairs. A row counts only if every condition is met. |
Examples
| Formula | What it does | Result |
|---|---|---|
=COUNTIFS(B2:B11,I1,D2:D11,I2) | Sales of the product in I2 in the region in I1. | 2 |
=COUNTIFS(E2:E11,">=2",E2:E11,"<=4") | Sales of 2 to 4 units. | 7 |
=COUNTIFS(C2:C11,"Ana",F2:F11,">1500") | Ana's sales above 1,500. | 2 |
=COUNTIFS(A2:A11,">="&DATE(2026,3,1)) | Sales on or after 1 March 2026. | 4 |
Common mistakes
Ranges of different sizesEvery criteria range must have the same number of rows, or COUNTIFS returns #VALUE!.
Expecting ORCOUNTIFS combines conditions with AND. Add two COUNTIFS for OR.
Related functions
Learn more
Download the example workbook (.xlsx)
The workbook has the same sample data and formulas, plus a practice sheet.