A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
What you're missing is that the formula doesn't actually return exactly 37. COUNTIF(), like all XL formulae, looks at the stored value of the cell, not what is displayed. Depending on formatting, the two can be quite different.
Like nearly every spreadsheet extant, XL uses floating point double precision, which allows about 15 decimal digits of precision, so the vast majority of non-integer calculations will have the possibility of some small rounding error.
For instance, if you have formatting set to show zero places after the decimal point, any number from 36.5000000000000 to 37.4999999999999 will display as 37, but COUNTIF() will only count 37.000000000000000
Couple of suggestions:
- Round your data
=ROUND(<your current formula here>, 0)
- Look for a range, say plus or minus 0.01, inclusive:
=COUNTIF($S$43:$S$68,">="& 37 - 0.01) - COUNTIF($S$43:$S$68,">" & 37 + 0.01)
- IF you are VERY judicious in how you format your values, you may be able to set XL Preferences/Calculation to "Precision as displayed", which will automatically round/truncate values to whatever precision your formatting is set at. This is not a trivial exercise - small errors can balloon quickly.