Skip to content

Commit df7c61a

Browse files
author
Sreten Ilić
committed
Fix sumif PHPOffice#683
1 parent 57404f4 commit df7c61a

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

src/PhpSpreadsheet/Calculation/Functions.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ public static function isCellValue($idx)
267267
public static function ifCondition($condition)
268268
{
269269
$condition = self::flattenSingleValue($condition);
270-
if (!isset($condition[0])) {
270+
if (!isset($condition[0]) && !is_numeric($condition)) {
271271
$condition = '=""';
272272
}
273273
if (!in_array($condition[0], ['>', '<', '='])) {

tests/data/Calculation/MathTrig/SUMIF.php

+24
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,28 @@
5858
[100],
5959
],
6060
],
61+
[
62+
100,
63+
[
64+
['0'],
65+
['some text'],
66+
],
67+
0, // Compare integer with string
68+
[
69+
[100],
70+
[1],
71+
],
72+
],
73+
[
74+
100,
75+
[
76+
[0],
77+
['some text'],
78+
],
79+
0, // Compare integer with integer
80+
[
81+
[100],
82+
[1],
83+
],
84+
],
6185
];

0 commit comments

Comments
 (0)