Bug 46647

Summary: COUNTIF function evaluates "<>" operator incorrectly
Product: POI Reporter: Josh Micich <josh>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: critical    
Priority: P4    
Version: 3.2-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
URL: http://mail-archives.apache.org/mod_mbox/poi-user/200902.mbox/%3CBLU142-W251C33C5EB0BED090300479CC50@phx.gbl%3E

Description Josh Micich 2009-02-02 11:39:29 UTC
Should have "case NE: return cmpResult != 0;" on line 131:
http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Countif.java?annotate=734243

There are also problems with string to number conversion, for example:
'<>123' should always match string values, even '123' (the only thing it doesn't match is 123).
'>5' should never match any string value, even '6'

No string-to-number conversion is ever required for operators besides '=' and '' (no operator, very similar to '=')
Comment 1 Josh Micich 2009-02-02 12:19:02 UTC
Fixed in svn 740088

Junits added.

This bug was initiated due to the post 'About the evaluation of "countif"' from Miki Haruki (三木 春樹) on poi-user.

Thanks for the detailed problem description.