Use COUNTIFS to count rows that meet both conditions
COUNTIFS counts the rows where every condition you give it is true. Each condition is a pair: a range, and the criteria to test it against.
=COUNTIFS(criteria_range1, criteria1, criteria_range2, criteria2)
You can add more pairs when you need them. A row counts only when it passes all of them.
A task list example
Here is a sample task list:
| Task | Owner | Status |
|---|---|---|
| Invoice client | Dana | Open |
| Call vendor | Sam | Open |
| Order stock | Dana | Done |
| Update sheet | Dana | Open |
| Pay rent | Sam | Open |
To count the open tasks that Dana owns:
=COUNTIFS(B2:B6, "Dana", C2:C6, "Open")
The result is 2: “Invoice client” and “Update sheet”. “Order stock” belongs to Dana but is already done, and the other open tasks belong to Sam.
Count rows within a date range
Test the same date column twice to count the rows between two dates. To count the rows dated in February 2026, with the dates in column D:
=COUNTIFS(D2:D200, ">="&DATE(2026,2,1), D2:D200, "<"&DATE(2026,3,1))
The end test uses “before March 1”, so every day in February is included and nothing from March is. The same approach works for numbers, as in =COUNTIFS(B2:B200, ">=50", B2:B200, "<=100"), which counts the values from 50 to 100.
Use cell references for criteria
Rather than typing “Dana” into the formula, put it in a cell, such as G1, and refer to that cell:
=COUNTIFS(B2:B6, $G$1, C2:C6, $G$2)
The dollar signs keep the references fixed when you copy the formula elsewhere. Changing G1 or G2 updates the count. How to lock cell reference in excel explains the details.
Use OR logic with separate counts
COUNTIFS works with AND. To count Dana’s open tasks or Sam’s open tasks, add two COUNTIFS together:
=COUNTIFS(B2:B6, "Dana", C2:C6, "Open") + COUNTIFS(B2:B6, "Sam", C2:C6, "Open")
This returns 4 for the sample list. Adding separate counts only works when the conditions don’t overlap, because a row that matched both would be counted twice. Here it’s safe, since each task has one owner.
Fix common problems
- #VALUE! appears when the criteria ranges are different sizes. Each pair must cover the same number of rows, such as B2:B6 with C2:C6.
- A result of 0 usually means a criterion doesn’t match the text in the cells. Check spelling and extra spaces.
- An unexpectedly high count can come from a range that includes a header row or a total row. Check that the ranges start and end where the data does.
Summing rather than counting
If you need the total of a column for rows that meet the same tests, use SUMIFS. The structure is almost identical, and sumifs with multiple criteria in excel covers it. For a single test, how to use countif in excel is the simpler version.