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

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates  |  Delete Blank Rows  |  Combine Columns or Cells without Losing Data  |  Round without Formula ...
Super VLookup: Multiple Criteria  |  Multiple Value  |  Across Multi-Sheets  |  Fuzzy Lookup...
Adv. Drop-down List: Easy Drop Down List  |  Dependent Drop Down List  |  Multi-select Drop Down List...
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  Compare Columns to Select Same & Different Cells ...
Featured Features: Grid Focus  |  Design View  |  Big Formula Bar  |  Workbook & Sheet Manager | Resource Library (Auto Text)  |  Date Picker  |  Combine Worksheets  |  Encrypt/Decrypt Cells  |  Send Emails by List  |  Super Filter  |  Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters ...)  |  50+ Chart Types (Gantt Chart ...)  |  40+ Practical Formulas (Calculate age based on birthday ...)  |  19 Insertion Tools (Insert QR Code, Insert Picture from Path ...)  |  12 Conversion Tools (Numbers to Words, Currency Conversion ...)  |  7 Merge & Split Tools (Advanced Combine Rows, Split Excel Cells ...)  |  ... and more

Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...

Description


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, Edge and Firefox.
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