Skip to content

How to count rows that meet two criteria in Excel and Google Sheets

Excel & Google Sheets
=COUNTIFS(A2:A6,"North",B2:B6,"Apple")

Verified example

Computed by a real spreadsheet engine on the sample data below.

RegionProduct
NorthApple
SouthBanana
NorthApple
EastApple
NorthCherry

=COUNTIFS(A2:A6,"North",B2:B6,"Apple")2

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

Step by step

  1. 1Select the output cell.
  2. 2Type =COUNTIFS(.
  3. 3Enter the first criteria range (e.g. A2:A6), a comma, then the first criterion ("North").
  4. 4Add another comma, enter the second criteria range (B2:B6), a comma, then the second criterion ("Apple").
  5. 5Close the parenthesis and press Enter. All pairs are evaluated with AND logic — a row is counted only when all criteria match.

Tips

Working on a sheet you inherited? Run the Auditor on the whole file first — it flags every #REF!, #N/A, broken column pattern, and inconsistent formula in seconds, free, no signup.

Frequently asked

How do I count rows that meet criterion A OR criterion B?

Add two COUNTIFS: =COUNTIFS(A2:A6,"North",B2:B6,"Apple")+COUNTIFS(A2:A6,"South",B2:B6,"Apple"). Subtract double-counted rows if needed with a third COUNTIFS.

Can I use wildcards in COUNTIFS?

Yes. Wildcards (* and ?) work the same as in COUNTIF.

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: