Over 2 million + professionals use CFI to learn accounting, financial analysis, modeling and more. Unlock the essentials of corporate finance with our free resources and get an exclusive sneak peek at the first module of each course.
Start Free
The COUNTIFS function in Excel counts the number of cells that meet one or more criteria across multiple ranges. It is an advanced version of COUNTIF, supporting up to 127 range/criteria pairs. The function is used for data analysis tasks, such as counting tasks by date and priority. Syntax: =COUNTIFS(criteria_range1, criteria1, [criteria_range2, criteria2], …). It handles numerical, text, and wildcard criteria. Common errors include mismatched range lengths and overly long text strings.
What is the COUNTIFS Function?
The COUNTIFS Function[1] is categorized under Excel Statistical functions. COUNTIFS will count the number of cells that meet a single criterion or multiple criteria in the same or different ranges.
The difference between COUNTIF and COUNTIFS is that COUNTIF is designed for counting cells with a single condition in one range, whereas COUNTIFS can evaluate different criteria in the same or different ranges.
When doing financial analysis, COUNTIF helps in doing a quick analysis. For example, we are given a list of tasks to be completed by a department, and the dates and priority of each task. In such a scenario, we can prepare a table showing the date, count of each task, and their priority using the COUNTIFS function.
The COUNTIFS function uses the following arguments:
Criteria_range1 (required argument) – This is the first range that would be evaluated with the associated criteria.
Criteria1 (required argument) – The conditions to be tested against the values. The criteria can be in the form of a number, expression, cell reference, or text that define which cells shall be counted. For example, criteria can be expressed as 2, “>2,” A4, “Mangoes,” or “32.”
Criteria_range2, criteria2, … (optional argument) – Additional ranges and their associated criteria. The function allows up to 127 range/criteria pairs.
The given criteria can be any of the following:
It is a numeric value. It can be an integer, decimal, date, time, or logical value.
A text string. It may include wildcards. Wildcards can be a ? (question mark) or an * (asterisk). A ? matches any single character, whereas, * matches any sequence of characters. If we wish to actually find the ? (question mark) or * (asterisk) character, we need to type the ~ symbol before this character in our search.
How to use the COUNTIFS Function?
As a worksheet function, the COUNTIFS function can be entered as part of a formula in a cell of a worksheet.
To understand the uses of the function, let’s consider a few examples:
Example 1
Let’s assume we are given the following data:
We want to get a count of items that are in stock (value in column C is greater than 0) but remain unsold (value is column D is equal to 0).
Here, as we can see, it’s only Brown Bread where no stock is sold. The result we get is:
Example 2
Let’s create count by month. For that, we need to use two functions – the COUNTIFS function and the EDATE function with two criteria.
Suppose we are given the following data:
The list of issues is in Column B. Each issue includes a date (column C) and priority (column D).
Starting in cell B15, we prepared a summary table that shows a total count per day and a total count per day per priority.
The first column of the summary table is a date. With the actual dates in column C, we can easily construct the criteria we need using the date itself and a second date created with the EDATE function.
The formula used here is:
The formula generates the correct count for each date. For priorities, we used the formula below:
The formula returns a count by date but broken down by priority, which is picked up directly from row 6.
The end result is the number of tasks to be done in terms of priority-wise:
Some notes about the COUNTIFS Function:
COUNTIFS is available from MS Excel 2000.
#VALUE! error – Occurs when:
The given criteria_range arrays are not equal in length.
The supplied criteria arguments are text strings that are greater than 255 characters long.
Each additional range should include the same number of rows and columns as the criteria_range1 argument, although it is necessary that they aren’t adjacent to each other.
Thanks for reading CFI’s guide to important Excel functions! By taking the time to learn and master these functions, you’ll significantly speed up your financial analysis. To learn more, check out these additional CFI resources:
To master the art of Excel, check out CFI’s Excel Crash Course, which teaches you how to become an Excel power user. Learn the most important formulas, functions, and shortcuts to become confident in your financial analysis.
Launch CFI’s Excel Crash Course now to take your career to the next level and move up the ladder!
Take your learning and productivity to the next level with our Premium Templates.
Upgrading to a paid membership gives you access to our extensive collection of plug-and-play Templates designed to power your performance—as well as CFI's full course catalog and accredited Certification Programs.
Gain unlimited access to more than 250 productivity Templates, CFI's full course catalog and accredited Certification Programs, hundreds of resources, expert reviews and support, the chance to work with real-world finance and research tools, and more.