Start free
Math & conditional sums

COUNTIFS function

COUNTIFS counts the rows that meet every condition you give it, such as orders that are from the East region and still open.

Available in Excel 2007 and later, Excel for the web and Google Sheets
On this page

COUNTIFS syntax

=COUNTIFS(criteria_range1, criteria1, [criteria_range2, criteria2], ...)
ArgumentRequiredWhat it means
criteria_range1YesThe range to test.
criteria1YesThe condition: "Open", ">100", "<>", or a cell.
criteria_range2, criteria2 …NoMore pairs. A row counts only when it meets all of them.

Examples

Open orders in one region

Rows where the region is East and the status is Open.

B8=COUNTIFS(B2:B6,"East",C2:C6,"Open")
RowABC
1OrderRegionStatus
2#1001EastOpen
3#1002WestOpen
4#1003EastClosed
5#1004EastOpen
6#1005NorthOpen
7
8Open in East2
=COUNTIFS(B2:B6,"East",C2:C6,"Open") → 2

Count values above a number

How many invoices are over 500. The operator and the number go inside the quotes together.

B7=COUNTIFS(B2:B5,">500")
RowAB
1InvoiceAmount
2INV-01320
3INV-02780
4INV-031,250
5INV-04500
6
7Over 5002
=COUNTIFS(B2:B5,">500") → 2

Common mistakes

  1. Expecting ">500" to include 500. It doesn't. Use ">=500" to count 500 itself.
  2. Ranges of different sizes. All criteria ranges must have the same number of rows.
  3. Counting blanks. Use "" to count empty cells and "<>" to count non-empty ones.

FAQ

What's the difference between COUNTIF and COUNTIFS?

COUNTIF takes one condition, COUNTIFS one or more. COUNTIFS covers both, so it's the one to learn.

How do I count cells between two numbers?

Use the same range twice: =COUNTIFS(B2:B5,">=100",B2:B5,"<=500").

Guides that use COUNTIFS

Worked problems with practice sheets.

Interview prepPractice sheet

SUMIFS interview question: summarise sales by region

Turn a raw sales list into a summary by region and product, without a pivot table. The formula interviewers expect, the $ signs that make it copy, and a sheet that grades yours.

4 min read · Updated

Know COUNTIFS? Prove it on a real sheet.

Practise COUNTIFS and the functions around it in a live grid that grades your result and explains your mistakes.

Runs in your browser · Graded on your result · No install