View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
joeu2004[_2_] joeu2004[_2_] is offline
external usenet poster
 
Posts: 829
Default countif function

"serhat" wrote:[i]
I have two values something like those;
0,0424063491580365
0,0424063491580364
If I subtract them I got zero but f I count
them with Countif function in a list I got these
two walues as different


I don't believe you get exactly zero. If they are in A1 and A2, calculate
=A1-A2 in A3, then compare =A3=0. It should return FALSE.

(Note: There is a reason why I avoid =A1-A2=0. Long story.)

I suspect you think their difference is zero only because of formatting.
When A3 is formatted as General, I get 1.04083E-16, a very small number.

Anyway, if you want to treat them as equal, you should use ROUND. But you
cannot use ROUND directly with COUNTIF. You could write:

=SUMPRODUCT(--(ROUND(A1:A10000,14)=A1))

But there are some subtle differences between that and COUNTIF, especially
when A1:A10000 contains numeric text.

Note: It is "bad practice" to write COUNTIF(A:A,A1), even though you can.
It is not too bad using Excel 2003 and earlier. But with Excel 2007 and
later, Excel must do 1+ million comparisons. It is unlikely you ever have
that many rows. Instead of A:A, choose a reason range like A1:A10000 or
even A1:A100000.