How to count cells between two values
✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)Count how many numbers fall inside a range, like between 10 and 20.
The formula
| App | Formula | Notes |
|---|---|---|
| Excel (desktop) | =COUNTIFS(A2:A6,">=10",A2:A6,"<=20") | Both conditions on the same range. Use ">" / "<" for exclusive bounds. |
| Google Sheets | =COUNTIFS(A2:A6,">=10",A2:A6,"<=20") | Identical. |
| LibreOffice Calc | =COUNTIFS(A2:A6,">=10",A2:A6,"<=20") | Identical. |
How it works
A "between" count is just two conditions on the same range: at least 10 AND at most 20. Here 12, 20 and 15 qualify while 5 and 25 fall outside — count 3. To reference cells for the bounds, concatenate: =COUNTIFS(A2:A6,">="&C1,A2:A6,"<="&C2). SUMIFS/AVERAGEIFS take the same pattern for summing or averaging a band.
Verified, not just documented
We ran =COUNTIFS(A2:A6,">=10",A2:A6,"<=20") in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 3 — exactly the expected result. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned 3 for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run desktop Excel.
Functions used
COUNTIFS — see full Excel, Google Sheets & LibreOffice compatibility for each.
Related recipes
- How to count dates within a range
- How to count with multiple criteria (COUNTIFS)
- How to use COUNTIFS (count with multiple conditions)
- How to rank values within groups