aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Burch <nick@apache.org>2011-09-14 14:41:03 +0000
committerNick Burch <nick@apache.org>2011-09-14 14:41:03 +0000
commit202be296f69689eb6a03e8301abc74847a0041d4 (patch)
tree68d7b508ab7959bd551a9a8c43f4f14663b2dd88
parentbd6b5d24947b58629a0f816fb464994a7ac829ea (diff)
downloadpoi-202be296f69689eb6a03e8301abc74847a0041d4.tar.gz
poi-202be296f69689eb6a03e8301abc74847a0041d4.zip
Apply patch from bug #51809 - correct GTE handling in COUNTIF
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1170652 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/documentation/content/xdocs/status.xml1
-rw-r--r--src/java/org/apache/poi/ss/formula/functions/Countif.java2
-rw-r--r--src/testcases/org/apache/poi/ss/formula/functions/TestSumif.java8
3 files changed, 10 insertions, 1 deletions
diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml
index 039edc3251..be005a1d78 100644
--- a/src/documentation/content/xdocs/status.xml
+++ b/src/documentation/content/xdocs/status.xml
@@ -34,6 +34,7 @@
<changes>
<release version="3.8-beta5" date="2011-??-??">
+ <action dev="poi-developers" type="fix">51809 - correct GTE handling in COUNTIF</action>
<action dev="poi-developers" type="add">Add HWPF API to update range text and delete bookmarks</action>
<action dev="poi-developers" type="add">HWPF Bookmarks tables are correctly updated on text updates</action>
<action dev="poi-developers" type="add">51670 - avoid LeftoverDataException when reading .xls files with invalid LabelRecords</action>
diff --git a/src/java/org/apache/poi/ss/formula/functions/Countif.java b/src/java/org/apache/poi/ss/formula/functions/Countif.java
index 2b7601c871..173f6a1e77 100644
--- a/src/java/org/apache/poi/ss/formula/functions/Countif.java
+++ b/src/java/org/apache/poi/ss/formula/functions/Countif.java
@@ -133,7 +133,7 @@ public final class Countif extends Fixed2ArgFunction {
case LT: return cmpResult < 0;
case LE: return cmpResult <= 0;
case GT: return cmpResult > 0;
- case GE: return cmpResult <= 0;
+ case GE: return cmpResult >= 0;
}
throw new RuntimeException("Cannot call boolean evaluate on non-equality operator '"
+ _representation + "'");
diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestSumif.java b/src/testcases/org/apache/poi/ss/formula/functions/TestSumif.java
index 1ef090ea4f..6cee5eab7c 100644
--- a/src/testcases/org/apache/poi/ss/formula/functions/TestSumif.java
+++ b/src/testcases/org/apache/poi/ss/formula/functions/TestSumif.java
@@ -61,6 +61,14 @@ public final class TestSumif extends TestCase {
confirm(60.0, arg0, new NumberEval(30.0));
confirm(70.0, arg0, new NumberEval(30.0), arg2);
confirm(100.0, arg0, new StringEval(">45"));
+ confirm(100.0, arg0, new StringEval(">=45"));
+ confirm(100.0, arg0, new StringEval(">=50.0"));
+ confirm(140.0, arg0, new StringEval("<45"));
+ confirm(140.0, arg0, new StringEval("<=45"));
+ confirm(140.0, arg0, new StringEval("<=40.0"));
+ confirm(160.0, arg0, new StringEval("<>40.0"));
+ confirm(80.0, arg0, new StringEval("=40.0"));
+
}
private static void confirm(double expectedResult, ValueEval...args) {