
If you’ve ever needed to count based on multiple conditions in Excel, then COUNTIFS
is the function you should know. It’s the advanced version of COUNTIF
, allowing us to apply multiple criteria at once. In this guide, I’ll explain how COUNTIFS works in Excel and share some of the best COUNTIFS examples.
Understanding COUNTIFS Syntax
The syntax for the COUNTIFS
function is straightforward:
=COUNTIFS(criteria_range1, criteria1, [criteria_range2, criteria2]…)
Where:
criteria_range1
– the first range where criteria will be applied.criteria1
– the condition that must be met in the first range.[criteria_range2, criteria2]
– additional ranges and criteria (optional).
Each criteria range must have the same number of rows and columns, or Excel will return an error.
Basic Example: Counting Sales Over 500
Let’s assume we have a list of sales figures in column A, and we want to count how many of them exceed 500.
=COUNTIFS(A2:A10, ">500")
This formula counts the number of values in the range A2:A10
that are greater than 500.
Using COUNTIFS with Multiple Conditions
Now, let’s get more advanced. Imagine we have a sales database where:
- Column A contains sales values.
- Column B contains the names of sales representatives.
- Column C contains the regions.
We want to count how many sales were made by “John” in the “North” region with sales exceeding 500.
=COUNTIFS(A2:A20, ">500", B2:B20, "John", C2:C20, "North")
This function counts rows where:
- Sales in column A exceed 500.
- The salesperson in column B is “John”.
- The region in column C is “North”.
COUNTIFS with Date Conditions
Excel allows us to count based on date conditions. Suppose we have order dates in column A and we want to count the orders placed after January 1st, 2024.
=COUNTIFS(A2:A100, ">01/01/2024")
For dynamic date criteria, referencing a cell is useful:
=COUNTIFS(A2:A100, ">" & D1)
Here, Excel checks if values in A2:A100
are greater than the date in D1
.
COUNTIFS with Wildcards
Wildcards are useful when counting entries with partial matches. Excel supports:
*
– matches any number of characters.?
– matches a single character.
For example, counting all sales by people whose names start with “J”:
=COUNTIFS(B2:B50, "J*")
COUNTIFS Case Sensitivity
Excel’s COUNTIFS
function is not case-sensitive. That means “john” and “John” are treated the same. If case sensitivity is required, using an array formula with SUMPRODUCT
is a workaround.
Common COUNTIFS Errors
Some issues you might face include:
- #VALUE! error: Mismatched range sizes.
- 0 returned: Criteria don’t match any data.
- Date errors: Ensure dates are correctly formatted.
COUNTIFS Table Example
Consider this dataset:
Sales | Salesperson | Region |
---|---|---|
600 | John | North |
400 | Jane | South |
700 | John | North |
To count sales higher than 500 in the North region by John:
=COUNTIFS(A2:A4, ">500", B2:B4, "John", C2:C4, "North")
Result: 2
Final Thoughts
The COUNTIFS
function is powerful for analyzing data with multiple conditions in Excel. Whether counting sales, dates, or text occurrences, mastering COUNTIFS
helps streamline data analysis efficiently.
Other interesting article:
How COUNTIF works in Excel? Best COUNTIF examples