Go Back

How to Use the COUNTIF Function to Count Cells Between Two Numbers

Read time: 25 minutes

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 :


Use >= for greater than or equal to

Use <= 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:

=COUNTIFS(B2:B7,">0", C2:C7,"=0")

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:

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

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.

Did this post not answer your question? Get a solution from connecting with the expert.

Another blog reader asked this question today on Excelchat:
Here are some problems that our users have asked and received explanations on

Hello, I am having an issue with a formula in excel. I have a list of dates and I need to count the number of dates between today and 30 days before today. I.e. How many times is a date occurring between now and 12 January 2018. I have been able to get the count of the dates that are past 1-29 days overdue, and 30+ days overdue but for some reason it won't work the other way. Logically, the following should work but doesn't and I have tried a number of different sums including -30, <, > etc =COUNTIF(F2:F211,"="&TODAY()+30)
Solved by M. D. in 14 mins
Hi Can you assist, I am using a countif formula and want to include indirect to count the number of "P" between 2 dates. I have this formula working but cant seem to get to work using indirect as get #value I want to use indirect as I have several similar sheets and just want 1 summary page. Working formula not using indirect =COUNTIFS(Sample!6:6,">="&B5,Sample!6:6,"<="&C5,Sample!8:8,"="&I7) Non working formula using indirect =COUNTIF(INDIRECT("'"&$G$2&"'!"&$C6,">="&B5),(INDIRECT("'"&$G$2&"'!"&$C6,"<="&C5),(INDIRECT("'"&$G$2&"'!"&$C8),I$7))) G2=Sheetname which one is called sample C6=6:6 C8=8:8 B5=From date B6=To date I7=P Thanks Matt
Solved by G. U. in 25 mins
Hi, i have a column with £ values in, i want to count the number of cells that contain a value between x & y. However, i want to use a cell reference for x & y rather than a number. The formula below gives me the count of records that are above the lower value but i cant seem to add the higher value =COUNTIF($A$2:$A$1742,">"& E4 ) Research suggested that the formula below would work...but it doesnt =COUNTIF($A$2:$A$1742,">"& E4, $A$2:$A$1742,"<"& F4 )
Solved by O. D. in 15 mins
Solved by I. E. in 28 mins
I have a list of numbers with 0's between example: 1 2 0 3 4 0 5 6 0 and i need list only the numbers above the 0's and not duplicate the first number example would be: 2 4 6 omit the cell information, but what i have and it is not working is: =IFERROR(INDEX($M$11:$M$1317,MATCH(S9,IF(ISBLANK($M$11:$M$1317),1,COUNTIF($V$10:$V$11,$M$11:$M$1317)),0)-1,1),"") I know i'm very close!
Solved by F. C. in 17 mins
I need a formula that will count the number of text events in tab 1, column BN, between two dates (j field to the right vs. tab 1, column E). I cannot get the countifs function to work...
Solved by E. H. in 20 mins
I need a formula to tell me how many cells in a column are between two numbers (e.g. 70 to 71). Have tried countif, but am likely doing it wrong. Thanks
Solved by S. Y. in 21 mins
I need to link the value of a drop down option to a COUNTIF function between tabs. Also, I need to use a conditional formatting function to give a pass/fail grade depending on the numbers generated from the previous functions. This is all between sheets in the same workbook.
Solved by C. J. in 27 mins
trying to count number of each package sold between two dates (using data validation list) - data includes: - date sold (B1:B10) - package sold on each date (D1:D10) (data validation list) - names of each package for drop down list: Q1:Q3 -start date and end date for each month (N9 and O9) this didn't work :COUNTIFS(D3:D5,Q2,B3:B8,">="&N9,B3:B8,"<="&O9) I also tried a formula I successfully used to total the earnings: SUMIFS(price,dates,">="&P25,dates,"<="&Q25)
Solved by O. C. in 12 mins

Leave a Comment