Skip to content

Commit

Permalink
Fix sumif PHPOffice#683
Browse files Browse the repository at this point in the history
  • Loading branch information
Sreten Ilić committed Oct 2, 2018
1 parent 57404f4 commit df7c61a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/PhpSpreadsheet/Calculation/Functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public static function isCellValue($idx)
public static function ifCondition($condition)
{
$condition = self::flattenSingleValue($condition);
if (!isset($condition[0])) {
if (!isset($condition[0]) && !is_numeric($condition)) {
$condition = '=""';
}
if (!in_array($condition[0], ['>', '<', '='])) {
Expand Down
24 changes: 24 additions & 0 deletions tests/data/Calculation/MathTrig/SUMIF.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,28 @@
[100],
],
],
[
100,
[
['0'],
['some text'],
],
0, // Compare integer with string
[
[100],
[1],
],
],
[
100,
[
[0],
['some text'],
],
0, // Compare integer with integer
[
[100],
[1],
],
],
];

0 comments on commit df7c61a

Please sign in to comment.