← All how-to recipes

How to count cells between two values

✓ Verified in LibreOffice 25.8.7.3

Count how many numbers fall inside a range, like between 10 and 20.

The formula

AppFormulaNotes
Excel=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. Every formula here is confirmed by actually executing it.