Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

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


Excel Productivity Tools

Ribbon of Excel (with Kutools for Excel installed)

300 Advanced Features Help 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.

  • 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.
  • 60-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years.

Screen Shot of Excel (with Office Tab installed)

Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Firefox, And New IE

  • Office Tab Increases your productivity by 50% when viewing and editing multiple documents.
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • One second to switch between dozens of open documents!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.

Be the first to comment.