[gnumeric] SUMIF: fix problem with strings that parse as numbers.



commit 1aa4a9661e03fcd69d59373f3e7fb49815f878e5
Author: Morten Welinder <terra gnome org>
Date:   Thu Dec 10 12:47:09 2009 -0500

    SUMIF: fix problem with strings that parse as numbers.

 ChangeLog         |    5 +++++
 NEWS              |    2 +-
 samples/sumif.xls |  Bin 16384 -> 9728 bytes
 src/value.c       |    4 +++-
 4 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index cdda890..97c8c07 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-12-10  Morten Welinder  <terra gnome org>
+
+	* src/value.c (parse_criteria): If the criteria is a string that
+	parses as a number, use equality search.  Fixes #604214.
+
 2009-12-10  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* src/print.c (gnm_print_sheet): store print date
diff --git a/NEWS b/NEWS
index 725cc3b..62d1d8e 100644
--- a/NEWS
+++ b/NEWS
@@ -13,7 +13,7 @@ Morten:
 	* Elminate use of "float".
 	* Fix selection problem.  [#601107]
 	* Automate solver testing.
-	* Fix SUMIF problem.  [#603671]
+	* Fix SUMIF problems.  [#603671] [#604214]
 	* Fix DATEDIF problem across bogus 1900-02-29.  [#599461]
 	* Fix graph editor crash.  [#604223]
 	* Fix goal seek problems.
diff --git a/samples/sumif.xls b/samples/sumif.xls
index 077c044..90e82cb 100755
Binary files a/samples/sumif.xls and b/samples/sumif.xls differ
diff --git a/src/value.c b/src/value.c
index 9225bb7..9cc76ea 100644
--- a/src/value.c
+++ b/src/value.c
@@ -1631,9 +1631,11 @@ parse_criteria (GnmValue const *crit_val, GODateConventions const *date_conv)
 		len = 0;
 	}
 
-	res->x = format_match (criteria + len, NULL, date_conv);
+	res->x = format_match_number (criteria + len, NULL, date_conv);
 	if (res->x == NULL)
 		res->x = value_new_string (criteria + len);
+	else if (len == 0 && VALUE_IS_NUMBER (res->x))
+		res->fun = criteria_test_equal;
 
 	empty = value_new_empty ();
 	if (res->fun (empty, res))



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]