COUNTIFS Function in☝️ Google Sheets Explained (Definition, Syntax, How to Use It, Examples)

This guide covers everything you need to know about the Google Sheets COUNTIFS function, including its definition, syntax, use cases, and how to use it.

What is the COUNTIFS Function? How Does It Work?

The COUNTIFS function in Google Sheets returns the count of cells in a range that meets multiple criteria. Its primary purpose is to provide a way to count the number of times certain data, which meets more than one condition, appears in a particular range.

Understanding the COUNTIFS function is crucial when dealing with vast datasets and needing to extract specific information grounded on several conditions. For example, if you’re going to count the number of employees in a company who are in a certain age range and work in a specific department, the COUNTIFS function would be incredibly useful.

It works by cross-checking the given criteria against the specified range. If the cell’s content matches all the criteria, it’s included in the count. The function continues this process across the entire range or ranges stated.

Notably, the COUNTIFS function can handle more than one pair of range-criterion. This means you can instruct the function to check against multiple conditions over different ranges. Any additional ranges must contain the same number of rows and columns as the first criteria range.

COUNTIFS Syntax

The syntax and arguments for the function are as follows:

COUNTIFS(criteria_range1, criterion1, [criteria_range2, criterion2, …])

Where:

  • criteria_range1: This is the first range that you want to apply the criterion to. It can be a single cell or a range of cells.
  • criterion1: This is the condition or criteria that you want to test against criteria_range1. It can be a number, expression, or text that defines which cells will be counted.
  • criteria_range2, criterion2, …: These are optional additional ranges and their associated criteria that you want to test. You can add as many additional range-criteria pairs as you need.

Usage notes related to syntax and arguments:

  • The COUNTIFS function in Google Sheets is case-insensitive. This means that it treats uppercase and lowercase characters as the same.
  • The criteria that you specify can be a number (like 10), an expression (like “>10” or “<=20”), a cell reference (like B1), a text string (like “yes” or “no”), or a date (like “1/1/2020”).
  • If you’re using a text string as a criterion, you need to enclose it in quotation marks.
  • If you’re using an expression as a criterion, you need to enclose it in quotation marks. For example, “>10” should be written as “>10”, not just >10.
  • If you’re comparing dates, you need to use the DATE function to create the date. For example, to compare a date in a cell with July 1, 2020, you would use the criterion DATE(2020,7,1).
  • The COUNTIFS function counts only those cells in the range that meet all the criteria. A cell in the range won’t be counted if it doesn’t meet at least one criterion.
  • All additional ranges (criteria_range2, criteria_range3, etc.) must have the same number of rows and columns as criteria_range1. If they don’t, the COUNTIFS function will return an error.

Examples of How to Use the COUNTIFS Function

Here are some practical examples of how to use the COUNTIFS function in Google Sheets:

Example #1: Counting Sales Above a Certain Value

Suppose you have a list of sales data, and you want to know how many sales were above $500. You can use the COUNTIFS function to do this. The formula would be:

=COUNTIFS(B2:B100, “>500”)

In this formula, B2:B100 is the range of cells that contain the sales data and “>500” is the condition that the sales must meet.

Example #2: Counting Sales Above a Certain Value in a Specific Month

You can also use the COUNTIFS function to count sales above a certain value in a specific month. For example, if you want to know how many sales were above $500 in January, you could use the following formula:

=COUNTIFS(B2:B100, “>500”, C2:C100, “January”)

In this formula, B2:B100 is the range of cells that contain the sales data, “>500” is the condition that the sales must meet, C2:C100 is the range of cells that contain the month data, and “January” is the condition that the month must meet.

Example #3: Counting Students with a Specific Grade in a Specific Subject

Suppose you have a list of students and their grades in different subjects. You want to know how many students got an A in Math. You can use the COUNTIFS function for this. The formula would be:

=COUNTIFS(B2:B100, “A”, C2:C100, “Math”)

In this formula, B2:B100 is the range of cells that contain the grade data, “A” is the condition that the grade must meet, C2:C100 is the range of cells that contain the subject data, and “Math” is the condition that the subject must meet.

Example #4: Counting Employees in a Specific Department with a Specific Job Title

If you have a list of employees, their departments, and their job titles, you can use the COUNTIFS function to count how many employees in a specific department have a specific job title. For example, if you want to know how many employees in the Sales department are Sales Managers, you could use the following formula:

=COUNTIFS(B2:B100, “Sales”, C2:C100, “Sales Manager”)

In this formula, B2:B100 is the range of cells that contain the department data, “Sales” is the condition that the department must meet, C2:C100 is the range of cells that contain the job title data, and “Sales Manager” is the condition that the job title must meet.

COUNTIFS: Common Mistakes & Problems

When using the COUNTIFS function in Google Sheets, there are some common mistakes and problems that users often encounter. Understanding these can help you avoid them and make the most of this powerful function:

  • Using Wrong Criteria Range: Another common mistake is using an incorrect criteria range. The criteria_range should be a range of cells that you want to evaluate against the criteria. If you select the wrong range, your results will be skewed.
  • Mismatched Range Sizes: The criteria ranges must all be the same size. If they’re not, you’ll get an error. Make sure all your ranges have the same number of rows and columns.
  • Incorrect Criteria: The criteria you use can also cause problems. The criteria should be a string, a number, or a cell reference. If you use the wrong type of criteria or if your criteria are too vague, the function might not return the results you expect.
  • Not Using Quotes for Text Criteria: If your criteria is a text string, make sure to enclose it in quotes. For example, if you want to count all cells that contain the word “apple”, your criteria should be “apple”, not apple. If you don’t use quotes, Google Sheets might interpret your criteria as a cell reference or a number, which can lead to unexpected results.
  • Forgetting to Use Wildcards: If you want to count cells that contain a certain text string anywhere within them, you need to use wildcards. For example, if you want to count all cells that contain “apple” anywhere in the text, your criteria should be “*apple*”. If you forget to use wildcards, the function will only count cells that exactly match your criteria.

Why Is COUNTIFS Not Working? Troubleshooting Common Errors

If you’re using the COUNTIFS function in Google Sheets and it’s not working as expected, you might be encountering one of several common errors. This section will guide you through these errors, their causes, and suggested solutions.

#VALUE! Error

Cause: This error typically occurs when the criteria in your COUNTIFS formula are not correctly set or the range and criteria range do not have the same dimensions.

Solution: Carefully review your criteria to ensure they are correctly defined. Also, make sure that the range and criteria range are of the same size. For example, if your range is A1:A10, your criteria range should also span 10 cells, like B1:B10.

#REF! Error

Cause: The #REF! error is usually a result of a reference to a cell or range of cells that no longer exists, often due to deleted cells or sheets.

Solution: Check your formula to ensure all referenced cells are still present. If a cell or range has been deleted, you will need to adjust your formula to reference existing cells.

#N/A Error

Cause: This error appears when Google Sheets cannot find the specified criteria in the selected range.

Solution: Confirm that the criteria you’re using in your COUNTIFS function actually exist in the selected range. You might have misspelled a word or used an incorrect data type.

#NUM! Error

Cause: The #NUM! error typically appears when your formula contains numeric values that are not valid. This could be due to extremely large or small numbers or numbers in the wrong format.

Solution: Check your formula for any numeric values and ensure they are valid. Avoid using very large or small numbers, and make sure numbers are in the correct format. For example, avoid using commas in numbers, as Google Sheets might interpret them as text instead of numbers.

Error: Formula Parse Error

Cause: This error occurs when Google Sheets cannot understand your formula. This can be due to various reasons, such as missing brackets, incorrect use of quotation marks, or using the wrong syntax.

Solution: Carefully review your formula to ensure it is correctly structured. Ensure all brackets are paired and that quotation marks are correctly used around the text. Also, double-check the syntax of the COUNTIFS function to ensure you’re using it correctly.

Error: Circular Dependency Detected

Cause: This error happens when your formula refers to its own cell, either directly or indirectly, creating a loop that Google Sheets can’t resolve.

Solution: Check your formula to see if it’s referencing its own cell. If it is, you’ll need to adjust the formula so it doesn’t refer to itself.

Using COUNTIFS With Other Google Sheets Functions

Combining the COUNTIFS function with other Google Sheets functions can significantly enhance your data analysis capabilities. This section will provide examples of how to use COUNTIFS with some other popular Google Sheets functions such as SUM, AVERAGE, and MAX.

With SUM function

Usage: The SUM function can be used with COUNTIFS to calculate the sum of values in a range that meets multiple criteria.

Example: Suppose you have a sales data set where column A contains the salesperson’s name, column B contains the sales amount, and column C contains the sales region. You want to find out the total sales amount for a particular salesperson in a specific region.

The formula would be:

=SUM(COUNTIFS(A:A, “John”, C:C, “West”, B:B))

This formula will count the number of instances where “John” appears in column A and “West” in column C, and then sum up the corresponding sales amount in column B.

With AVERAGE function

Usage: The AVERAGE function can be used with COUNTIFS to calculate the average of values in a range that meets multiple criteria.

Example: Using the same sales data set, you want to find out the average sales amount for a particular salesperson in a specific region.

The formula would be:

=AVERAGE(COUNTIFS(A:A, “John”, C:C, “West”, B:B))

This formula will count the number of instances where “John” appears in column A and “West” in column C, and then calculate the average sales amount in column B.

With MAX function

Usage: The MAX function can be used with COUNTIFS to find the maximum value in a range that meets multiple criteria.

Example: Using the same sales data set, you want to find out the highest sales amount for a particular salesperson in a specific region.

The formula would be:

=MAX(COUNTIFS(A:A, “John”, C:C, “West”, B:B))

This formula will count the number of instances where “John” appears in column A and “West” in column C, and then return the highest sales amount in column B.

For more details on the COUNTIFS function, check out the official documentation at the Google Docs Editors Help Center.

More Google Sheets Tutorials
More Microsoft Excel Tutorials
Share This Post
Daniel Smith
Daniel Smith
Daniel Smith is automation consultant with a passion for technology, data, AI, and machine learning.