How can I count number of students whose marks lies between 40 to 50 (say) in a column?

How can I count number of students whose marks lies between 40 to 50 (say) in a column?

Or you can simply use COUNTIF as in

COUNTIF(A1:10;">=40")-COUNTIF((A1:10;">50")

The usual COUNTIF function doesn’t work with multiple criteria. Perhaps something like:

=SUMPRODUCT((A1:A10>40)*(A1:A10<50))

Given a random assortment of numbers in A1:A10, this formula seems to give the right count of the numbers falling between 40 and 50 (exclusive).