30 Advanced Excel Tips for 2026

Excel Champs / Excel Formulas List / How to Count Between Two Numbers (COUNTIFS) in Excel (Formula)
By Puneet Gogia (Microsoft MVP)

How to Count Between Two Numbers (COUNTIFS) in Excel (Formula)

30+ Advanced Excel Tips for 2026

No spam. Only Excel Stuff. God Promise. 😊

To count values between two numbers, use COUNTIFS with two criteria on the same range: =COUNTIFS(B2:B26,">=10",B2:B26,"<=25") counts everything from 10 to 25, both ends included. The operators go inside double quotes, and the range is repeated for each condition.

To exclude the boundaries, drop the equal signs: =COUNTIFS(B2:B26,">10",B2:B26,"<25") counts 11 to 24. To pull the limits from cells instead of typing them, join with & — =COUNTIFS(B2:B26,">="&D1,B2:B26,"<="&D2) — which is the better setup if you want to change the range without editing the formula.

The same pattern works for dates: =COUNTIFS(B2:B26,">="&DATE(2026,1,1),B2:B26,"<="&DATE(2026,3,31)). COUNTIFS is the right tool here — SUMPRODUCT gets the same answer but is slower on large data.

In Excel, you can count between two numbers using the COUNTIFS function. With the COUNTIFS function, you can specify an upper limit of the numbers and a lower limit to create a range of numbers to count. In the following example, we have a list of names along with their corresponding ages. Now we need to count the people whose age is between two numbers.

list-of-names-and-age
Count Between Two Numbers / Excel Formula

Using COUNTIFS to Count Between Two Numbers

You can use the following steps to create a formula using COUNTIFS to count numbers between 10 and 25.

  1. First, enter “=COUNTIFS(” in cell C1.
    use-countifs-function
  2. After that, refer to the range from where you want to count the values.
    refer-to-a-range
  3. Next, you need to specify the upper number (25) using the less than or equal to sign (“<=25”).
    specify-the-upper-number
  4. From here, again you need to refer to the range of numbers in the criteria2.
    refer-to-the-range
  5. In the end, use the greater than or equal to sign (“>=10”) to specify the lower number, so numbers below 10 are not counted.
    specify-the-number-below
=COUNTIFS(B2:B26,"<=25",B2:B26,">=10")

COUNTIFS can take multiple criteria and count values based on them. To understand this formula, we need to split it into two parts.

split-the-countifs-function
  1. B2:B26 – This is the range of cells that the formula is evaluating. In this case, it’s checking each cell from B2 to B26.
  2. Criteria 1: “<=25” – This is the first condition applied to the cells in the range B2:B26. It tells Excel to consider only the cells where the value is less than or equal to 25.
  3. Criteria 2: “>=10” – This is the second condition applied to the cells in the same range. It instructs Excel to consider only the cells with a value greater than or equal to 10.

This formula will scan through each cell from B2 to B26 and count the number of cells containing a value between 10 and 25. The result will be the total number of cells between this range.

Using the COUNTIF Function

You can also use a formula using the COUNTIF function:

=COUNTIF(B2:B26,">=10")-COUNTIF(B2:B26,">25")

In this formula:

This formula is divided into two parts using the COUNTIF function.

  • The first part, COUNTIF(B2:B26,">=10"), counts the number of cells in the range B2 through B26 with a value greater than or equal to 10.
  • The second part, COUNTIF(B2:B26,">25"), counts the number of cells in the same range (B2 through B26) with a value greater than 25.
  • The - operator in between these two parts subtracts the count of cells with a value greater than 25 from the count of cells with a value greater than or equal to 10.

So, this formula’s result will give you the number of cells in the range B2 to B26 that have a value greater than or equal to 10 but less than or equal to 25.

Note – In Excel, criteria within functions like COUNTIF and COUNTIFS are placed inside double quotes to tell Excel to interpret them as text, including any operators like >, <, or =. This ensures that the formula understands what you want to compare, like “greater than or equal to 10” or “less than or equal to 25”.

Using SUMPRODUCT to Count Cells Between Two Numbers

You can also use the SUMPRODUCT function to count the number of cells between two numbers. In this formula, we use the INT function along with SUMPRODUCT. See the formula below:

=SUMPRODUCT(INT(B2:B26>=10),INT(B2:B26<=25))

It returns the same count as the COUNTIFS formula.

sumproduct-to-count-cells
  • SUMPRODUCT – The SUMPRODUCT function multiplies corresponding values in given arrays or ranges and then sums up all those products. It’s like doing a little bit of multiplication and addition simultaneously.
  • INT – The INT function in Excel rounds down a number to the nearest integer. This means it removes any decimal part of a number and leaves just the whole number part.

To understand the formula, we need to split it:

The INT function in Excel converts a value to an integer, so it turns TRUE into 1 and FALSE into 0.

When combined with a condition, such as B2:B26>=10, it returns an array of 1s and 0s. A 1 represents True, meaning the condition is met, and a 0 represents False, meaning the condition is not met.

Here, INT(B2:B26>=10) generates an array based on whether the values in cells B2 to B26 are greater than or equal to 10.

split-sumproduct-formula

Similarly, INT(B2:B26<=25) generates an array based on whether the values in cells B2 to B26 are less than or equal to 25.

sumproduct-with-different-arrays

With both INT functions, you have two different arrays. In the first, you have 1 for each number that is greater than or equal to 10, and in the second, 1 for the values that are lower than or equal to 25.

int-with-two-different-arrays

In the end, the SUMPRODUCT function in Excel multiplies corresponding components in the given arrays and returns the sum of those products.

When applied to the two arrays generated by INT(B2:B26>=10) and INT(B2:B26<=25), it multiplies each pair of corresponding elements together and sums the result.

This counts the number of cells where both conditions (values greater than or equal to 10 and less than or equal to 25) are true.

Which Formula is Better

Each of these formulas is designed to count the values in the range B2:B26 that fall between 10 and 25, inclusive, but they achieve the result using different approaches:

  • COUNTIFS: the most suitable formula. It allows multiple criteria within the same function and counts only the cells in B2:B26 where the value is greater than or equal to 10 and less than or equal to 25.
  • COUNTIF minus COUNTIF: counts the values greater than or equal to 10 and subtracts the values greater than 25, which leaves the count from 10 to 25. It also works in very old versions of Excel without COUNTIFS.
  • SUMPRODUCT with INT: builds two arrays of 1s and 0s (one for each condition) and multiplies them, so only the rows that meet both conditions add 1 to the count.

The COUNTIFS formula is typically the best choice for this scenario.

COUNTIFS is generally faster and more resource-efficient than SUMPRODUCT, especially for larger or more complex data, as it doesn’t require creating intermediate arrays or performing multiple operations.

Use Cells for the Two Numbers

Instead of typing 10 and 25 into the formula, enter them in cells (like E1 for the lower number and E2 for the upper number) and join each one with its operator using an ampersand. Now you can change the limits without editing the formula:

=COUNTIFS(B2:B26,">="&E1,B2:B26,"<="&E2)

Count Between Two Numbers without the Limits

All the formulas above include 10 and 25 in the count. If you want only the numbers strictly between them, use “>” and “<” without the equal sign:

=COUNTIFS(B2:B26,">10",B2:B26,"<25")

The same formulas work for dates and times as well, as Excel stores them as numbers. Just refer to cells with the two dates instead of typing them.

Read Next

Excel COUNT IF Greater Than 0 – COUNTIF Blank – COUNTIFS Less Than – COUNT Cells That are Not Blank – COUNTIF Not Equal To – COUNTIF with OR

Frequently Asked Questions

Why is COUNTIFS not counting some numbers?

Those numbers are stored as text (often left-aligned or with a green triangle). COUNTIFS skips them. Convert them into numbers, and they will be counted.

Can I count the numbers outside the two numbers?

Yes. Add two COUNTIF functions together. This one counts the numbers below 10 or above 25:

=COUNTIF(B2:B26,"<10")+COUNTIF(B2:B26,">25")

Does COUNTIFS count blank cells or text?

No. With number criteria like “>=10”, COUNTIFS only counts cells with numbers, so blank cells and text are ignored.

Puneet Gogia

Written by

Puneet Gogia

Microsoft MVP — Excel · Founder, Excel Champs

Twelve years of teaching Excel, and a decade before that using it as a data analyst. Every tutorial here is written from a file I actually built.

3M+ readers helped
1,000+ tutorials written
Since 2015 teaching Excel

Leave a Comment