You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by 三木 春樹 <mi...@hotmail.co.jp> on 2009/02/02 09:49:16 UTC

About the evaluation of "countif"

Hi,
 
I'm using POI-3.2-FINAL, and
 
I want to count the rows in my worksheet and added a formula to the sheet whose value is "countif(B2:B65535, "<>")".
but when I ran the program and got the generated file, the formula cell did not display the currect value.
for example, I have two rows of datas, but it displays 0, actually it should be 2.
 
after tracing the source, I found that the method "evaluate" of the class "Countif" may have a bug with it.
the argument "cmpResult" is returned by the method "compareTo" of the class "String".
and according to the javadoc of that method, when two strings to be compared is equal, it returns 0.
but in the method "evaluate", whenever the operator is EQ or NE, it always returns "cmpResult == 0".
 
is that a bug? or otherwise, how can I get a row count by using formulas?
 
thanks!!
_________________________________________________________________
【映画】007、メリケン・・話題の映画一挙紹介!この冬どれを観る?
http://feature.movies.jp.msn.com/special/juzu0901/

Re: About the evaluation of "countif"

Posted by Josh Micich <jo...@gmail.com>.
Hello Miki,

Thanks for identifying this bug.  It has now been fixed:

https://issues.apache.org/bugzilla/show_bug.cgi?id=46647

The fix should be available in 3.5beta5 (due soon) or on the next nightly
build.

regards,
Josh