Using the COUNTIFS function you can achieve the result of counting numbers of cells which contain values between two numbers in a range.
Using the COUNTIFS Function Between Two Values
The COUNTIFS function can show the count of cells that meet your criteria. You can use COUNTIF with criteria using dates, numbers, text and other conditions.
Using COUNTIFS you also need to use logical operators
The COUNTIFS function is built to count cells that meet multiple criteria. In this case, because we supply the same range for two criteria, each cell in the range must meet both criteria in order to be counted.
Generic formula :
>= for greater than or equal to
<= for less than or equal to
So if we want to count based on criteria : Between 80 and 90 in our table, we use this formula :
=COUNTIFS(B2:B9,">=80",B2:B9,"<=90") and the result should be 4 ( including : 82, 86, 81 and 90 )
Using COUNTIFS between dates
The following COUNTIFS formula shows this idea by counting the number of dates that fall between a start and end date. The following formula counts the number of dates in A2:A9 that are equal to or greater than the date in E1 and equal to or less than the date in E2:
To count the number of cells that contain dates between two dates, you can use the COUNTIFS function:
So dates between 11/07/14 and 11/11/14 are found 5 dates, from B2 cell to B7 cell.
The COUNTIFS formula with multiple criteria
Suppose you have a product list like in the example below, and you want to get a count of items that are in stock (value in column B is greater than 0) but have not been sold yet (value in column C is equal to 0).
The task can be accomplished by using this formula:
And the count is 2 (“Cherries” and “Lemons”)
When you want to count items with identical criteria, you still need to supply each criteria_range / criteria pair individually.
For example, here’s the right formula to count items that have 0 both in column B and column C:
This COUNTIFS formula returns 1 because only “Grapes” have “0” value in both columns.
Different problems have their own best solution. If you are stuck and want to get to the solution quick, ask your question to have it answered by an Excel expert in 20 minutes. They are available to help you 24/7 at the link to the right. The first question is free.