Two-way summary counting in Excel using COUNTIFS

The COUNTIF function can be used to count the number of cells that meet a certain criterion in Excel. But sometimes, you may need to count cells based on more than one criterion. In this tutorial, we will discuss how to use the COUNTIFS function to create two-way summary count in Excel.

How to perform two-way summary counting using COUNTIFS?

As shown in the table below, supposing you want to count how many males and females there are in the given countries respectively, you can follow the below steps.

Generic Formulas

=COUNTIFS(criteria_range1, criteria1, criteria_range2, criteria2, ... )

Arguments

Criteria_range1: The first range where you want to evaluate the criteria;
Criteria1: The first criteria that define which cells to be counted.
Criteria_range2, criteria2, ...: The additional ranges and their associated criteria. It allows you to apply no more than 127 range/criteria pairs.

How to use this formula?

In this case, \$D\$3:\$D\$11 is the range1, China is the criteria1 that locates in \$G3, \$E\$3:\$E\$11 is the range2, and H\$2 is the cell reference containing the criteria2.

1. Select a cell to place the first result. In this case, I select cell H3.

2. Enter the below formula into it and press the Enter key to get the result.

=COUNTIFS(\$D\$3:\$D\$11,\$G3,\$E\$3:\$E\$11,H\$2)

Note: If the criteria argument is a reference to an empty cell, the COUNTIFS function treats the empty cell as a 0 value.

3. Select the first result cell:

3.1) Drag the AutoFill Handle right to the cell to get the number of females in the same country.
3.2) Keep the row selected, and then drag the AutoFill Handle down to get the number of males and females in the other countries. See screenshot:

Related functions

Excel COUNTIF function
The Excel IF function is a statistical function in Excel which is used to count the number of cells that meet a criterion.

Related formulas

3D sum or sumif across multiple worksheets
This tutorial talks about how to sum the same range of cells across multiple consecutive or discontiguous worksheets in Excel.

Calculate running total
This tutorial explains a simple formula to help calculating running total in Excel.

Get subtotal by invoice number
This tutorial explains a formula based on the COUNTIF and SUMIF functions to get subtotal by invoice number in Excel.

Subtotal by colors
This step-by-step guide helps you perform subtotal by color with the SUMIF function.

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 Toolsets:  12 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...

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.