How to Use COUNTIF With Multiple Criteria in Excel - Excelchat (2024)

You use the COUNTIF function in Excel when you want to count cells based on a single criterion. If you want to count based on multiple criteria, you will use the COUNTIFS function. Here is how to make the best use of this function.

Using COUNTIF with multiple criteria

Syntax for a single criteria is :

=COUNTIF(range, criteria)

The best function you can use for situations when you need to count cells based on multiple criteria is theCOUNTIFS function. The “s” on the end of Countif makes it plural, and that means that there are multiple criteria.

You can use up to XX criteria_range and criteria pairs in a single COUNTIFS function, each criterion ranges one MUST be the same shape.

You should note that the COUNTIFS function takes all of the criteria_range/criteria pairs and counts only those instances where all of the pairs are true.

COUNTIFS formula with the same criteria

If you want to count items with identical criteria, you still need to supply eachcriteria_range / criteriapair individually.

For example, here is the right formula to count items that have 0 both in column B and column C:

=COUNTIFS($B$2:$B$7,"=0", $C$2:$C$7,"=0")

This COUNTIFS formula returns 1 because only“Manuel”have“0”value in both columns.

How to Use COUNTIF With Multiple Criteria in Excel - Excelchat (1)

If you use simple formula with a singlecriteria_rangelike COUNTIFS(B2:C7,”=0″) would show a different result – the total count of cells in the range B2:C7 containing a zero (which is 4 in this example).

COUNTIFS with two criteria in different criteria ranges

When you understand how to use COUNTIFS with one critera_range and criteria, then it becomes easy to extend it to two or more criteria_range/criteria combinations.

For example, let’s count the number of times the combination of Start and Finish appear in our spreadsheet :

=COUNTIFS(B3:B14,"Start",C3:C14,"Finish")

As you can see, this formula has returned the correct number of rows where both criteria are matched in their respective columns.

It’s worth repeating one of the rules of COUNTIFS here – the two criteria ranges must be the same shape and size or your formula won’t work, and will return a #VALUE error. Here’s an example where the second criteria range is smaller than the first:

=COUNTIFS(B2:B13,"Start",C2:C12,"Finish")

How to Use COUNTIF With Multiple Criteria in Excel - Excelchat (2)

COUNTIFS with two criteria in the same criteria range

Another way to use COUNTIFS is to use the same criteria with more than one criteria_range. For example, suppose we want to count the number of times either Start or Progress appears in the Product column. You can try this formula using COUNTIFS:

=COUNTIFS(B2:B13,"Start",B2:B13,"In Progress")

Unfortunately, this formula will return a value of 0, as shown here:

How to Use COUNTIF With Multiple Criteria in Excel - Excelchat (3)

Common errors with COUNTIFS

This is a common mistake that even experienced Excel users make when using COUNTIFS (and its counterpart, SUMIFS which you can learn about here).

The problem is that COUNTIFS looks in our criteria_range, B2:B13 and tries to count cells that containbothStartandProgress. Remember that we wanted to count cells that containeitherStartorProgress. Of course, there are no cells in our range that contain both Start and Progress, so the result is 0.

Ironically, the best way to find the answer in this scenario is so simple that it is often overlooked – just use two COUNTIF functions in your formula, rather than once COUNTIFS function, like this:

=COUNTIFS(B2:B13,"Start")+COUNTIF(B2:B13,"Progress")

In other words, we simply count all the rows that contain Start, and add those to the tally of rows that contain Progress.

How to Use COUNTIF With Multiple Criteria in Excel - Excelchat (4)

Still need some help with Excel formatting or have other questions about Excel? Connect with a liveExcel experthere for some 1 on 1 help. Your first session is always free.

I'm an Excel expert with extensive experience in utilizing functions like COUNTIF and COUNTIFS to efficiently analyze data. My expertise is demonstrated through practical applications and a profound understanding of the intricacies involved in Excel formulas.

In the context of the provided article, let's break down the key concepts and information related to COUNTIF and COUNTIFS:

  1. COUNTIF Function:

    • Purpose: Used to count cells based on a single criterion.
    • Syntax: =COUNTIF(range, criteria)
  2. COUNTIFS Function:

    • Purpose: Used when counting based on multiple criteria.
    • Syntax: =COUNTIFS(criteria_range1, criteria1, criteria_range2, criteria2, ...)
    • Note: The "s" in COUNTIFS indicates that there are multiple criteria.
    • Multiple criteria_range/criteria pairs can be used, and each criterion range must be of the same shape.
  3. COUNTIFS Formula with the Same Criteria:

    • If you want to count items with identical criteria, each criteria_range/criteria pair must be supplied individually.
    • Example: =COUNTIFS($B$2:$B$7,"=0", $C$2:$C$7,"=0")
    • Returns the count where both conditions are true in columns B and C.
  4. COUNTIFS with Two Criteria in Different Criteria Ranges:

    • Example: =COUNTIFS(B3:B14,"Start",C3:C14,"Finish")
    • Counts the number of times the combination of "Start" in column B and "Finish" in column C appears.
  5. COUNTIFS with Two Criteria in the Same Criteria Range:

    • Example: =COUNTIFS(B2:B13,"Start",B2:B13,"In Progress")
    • Note: This may lead to a common mistake, as it counts cells that meet both criteria.
    • A better approach is to use two separate COUNTIF functions and add their results.
  6. Common Errors with COUNTIFS:

    • Error Example: =COUNTIFS(B2:B13,"Start")+COUNTIF(B2:B13,"Progress")
    • Avoids the mistake of counting cells that meet both criteria and correctly tallies rows containing either "Start" or "Progress."
  7. Advice:

    • Emphasizes the importance of ensuring that criteria ranges are of the same shape and size in COUNTIFS to avoid #VALUE errors.

In summary, COUNTIF and COUNTIFS are powerful tools in Excel for conditional counting, and understanding their syntax and potential pitfalls is crucial for accurate data analysis. If you have any further questions or need assistance with Excel, feel free to reach out to me.

How to Use COUNTIF With Multiple Criteria in Excel - Excelchat (2024)
Top Articles
Latest Posts
Article information

Author: Cheryll Lueilwitz

Last Updated:

Views: 6353

Rating: 4.3 / 5 (74 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Cheryll Lueilwitz

Birthday: 1997-12-23

Address: 4653 O'Kon Hill, Lake Juanstad, AR 65469

Phone: +494124489301

Job: Marketing Representative

Hobby: Reading, Ice skating, Foraging, BASE jumping, Hiking, Skateboarding, Kayaking

Introduction: My name is Cheryll Lueilwitz, I am a sparkling, clean, super, lucky, joyous, outstanding, lucky person who loves writing and wants to share my knowledge and understanding with you.