Bug 46647 - COUNTIF function evaluates "<>" operator incorrectly
Summary: COUNTIF function evaluates "<>" operator incorrectly
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.2-FINAL
Hardware: PC Windows XP
: P4 critical (vote)
Target Milestone: ---
Assignee: POI Developers List
URL: http://mail-archives.apache.org/mod_m...
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-02 11:39 UTC by Josh Micich
Modified: 2009-02-02 12:19 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.