The guide · COUNTIFS
Syntax
=COUNTIFS(criteria_range1, criteria1, [criteria_range2, criteria2], …)
The arguments come in pairs: a range, then what to look for in it. A row is counted only when every pair matches. All the ranges must have the same number of rows.
A worked example
Twelve orders, with the region in column B and the status in column C. Five orders are from North, and seven are Shipped. Only the rows where both are true count: orders 1001, 1006 and 1012, so =COUNTIFS(B2:B13, "North", C2:C13, "Shipped") returns 3.
"North or South" needs two counts
It's tempting to write both regions into one COUNTIFS:
=COUNTIFS(B2:B13, "North", B2:B13, "South", C2:C13, "Shipped")
That asks for orders that are in North and South at the same time. There are none, so the answer is 0. For "either", count each region and add the results:
=COUNTIFS(B2:B13, "North", C2:C13, "Shipped")
+ COUNTIFS(B2:B13, "South", C2:C13, "Shipped")
Two conditions on the same column can work together when they describe a range of numbers: =COUNTIFS(D2:D13, ">=100", D2:D13, "<200") counts values from 100 up to, but not including, 200.
COUNTIF or COUNTIFS?
COUNTIF takes exactly one range and one condition. COUNTIFS takes one or more pairs, so it does everything COUNTIF does. SUMIFS works the same way, with the range to add in front.
Common mistakes
- OR inside one COUNTIFS. Two values for the same column give 0; add two COUNTIFS instead.
- COUNTIF with two pairs. COUNTIF only takes two arguments. Add the S.
- Ranges of different sizes.
B2:B13withC2:C12gives #VALUE!. - A missing condition. Counting only North gives every North order, shipped or not.
FAQ
- How do I use COUNTIFS with multiple criteria?
- Give it a range and a condition for each criterion: =COUNTIFS(B2:B13,"North",C2:C13,"Shipped") counts the rows where both match.
- How do I count with OR in COUNTIFS?
- Add one COUNTIFS for each option: =COUNTIFS(B2:B13,"North",C2:C13,"Shipped")+COUNTIFS(B2:B13,"South",C2:C13,"Shipped").
- Why does my COUNTIFS return 0?
- No row matches every condition at once. Two different values for the same column always give 0. Also check the spelling of each condition and extra spaces in the data.
- How do I count values between two numbers?
- Use the same range twice: =COUNTIFS(D2:D13,">=100",D2:D13,"<200").