Re: Count Functions



Alan wrote:
Although I haven't tried that, I've no doubt it works, and I know of your knowledge and skill over many years on these newsgroups, but with respect, isn't that a sledgehammer to crack a walnut?
Regards,
Alan.

That's not my call. If you've got a handier nutcracker, by all means ignore my post. But once it's coded and in my library, and after reviewing the responses in this thread, I personally don't see much of anything easier, nor more readily committed to memory, than typing in a cell

=CountBetw(a1:a100,0,15) if inclusive or
=CountBetw(a1:a100,0,15,false,false) if exclusive.

And the frequency with which the question arises in this newsgroup, and the qualification that always comes up in the responses about inclusive/not inclusive, suggested to me that something more intuitive and more obvious than, e.g.,

=SUMPRODUCT(--(ISNUMBER(A1:A100)),--(A1:A100>=0),--(A1:A100<=15))

might be useful.

Also, with respect, coding such a solution allows one to think through the problem and avoid posting things like

=SUMPRODUCT(--(A1:A13>=0),--(A1:A13<=15)), which, as was pointed out, counts empty cells as having values between 0 and 15; or

=SUMPRODUCT(--(A1:A100>=0),--(A1:A100<16)), which has the empty cells problem and also, which was also pointed out, doesn't allow for numbers between 15 and 16.

But to each his own.

Alan Beban
.



Relevant Pages