Skip to main content

Excel formula: Count cells equal to x and y

As you known, the COUNTIF function can count the number of cells that match with a specified condition. Here in this tutorial, it will provide some formulas to talk about counting cells that match with all given conditions, which we call it the AND logic with the COUNTIFS function.
doc count equal to x and y 1

Count cells equal to x and y

If you want to count cells meeting two conditions simultaneously, x and y, you can use the COUNTIFS function in Excel.

Generic formula:

COUNTIFS(range1,criteria1,[range2],[criteria2],…)

Example:

Here is a table containing products, sales and prices, now you want to count the number of products which sales are larger than 10000 and price are larger than 100. Please use below formulas:

=COUNTIFS($C$3:$C$7,$G$2,$D$3:$D$7,$G$3)

Or

=COUNTIFS($C$3:$C$7,">10000",$D$3:$D$7,">100")

In above formulas, $C$3:$C$7 is the first range to evaluate, $G$2 and “>10000” are the first criterion, $D$3:$D$7 is the second range to evaluate, , $G$3 and “>100” are the second criterion.

The press Enter key to get the counted result: 2 (Computer and Camera).
doc count equal to x and y 2

Count cells equal to multiple criteria

If you want to count cells equal to multiple criteria, for example, there is a table including three columns, Column Store, Column Product and Column Number, now you want to count the number of rows that meet three criteria:

Store: North*, which means that the store name must begin with North, * is the wildcard that indicates any character string.

Product: A.

Number: >2000

Using this formula

=COUNTIFS(B3:B8,G2,C3:C8,G3,D3:D8,G4)

or

=COUNTIFS(B3:B8,"North*",C3:C8,"A",D3:D8,">2000")

The press Enter key to get the counted result.
doc count equal to x and y 3

Tip:

For multiple criteria, just adding the range and criteria into the formula as this: COUNTIFS(range1,criteria1,range2,criteria2, range3,criteria3, range4,criteria4…rangeN,criteriaN) .

Sample File

doc sampleClick to download sample file


Relative Formulas


The Best Office Productivity Tools

Kutools for Excel - Helps You To Stand Out From Crowd

Would you like to complete your daily work quickly and perfectly? Kutools for Excel brings 300 powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) and save 80% time for you.

  • Designed for 1500 work scenarios, helps you solve 80% Excel problems.
  • Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands.
  • Become an Excel expert in 3 minutes. No longer need to remember any painful formulas and VBA codes.
  • 30-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years.
Ribbon of Excel (with Kutools for Excel installed)

Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)

  • One second to switch between dozens of open documents!
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Firefox, And New Internet Explorer.
Screen Shot of Excel (with Office Tab installed)
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations