diff --git a/src/PhpSpreadsheet/Calculation/Functions.php b/src/PhpSpreadsheet/Calculation/Functions.php index 40e7d96466..38bd87c65e 100644 --- a/src/PhpSpreadsheet/Calculation/Functions.php +++ b/src/PhpSpreadsheet/Calculation/Functions.php @@ -278,7 +278,7 @@ public static function ifCondition($condition) $condition = Calculation::wrapResult(strtoupper($condition)); } - return '=' . $condition; + return str_replace('""""', '""', '=' . $condition); } preg_match('/(=|<[>=]?|>=?)(.*)/', $condition, $matches); [, $operator, $operand] = $matches; @@ -290,7 +290,7 @@ public static function ifCondition($condition) $operand = Calculation::wrapResult(strtoupper($operand)); } - return $operator . $operand; + return str_replace('""""', '""', $operator . $operand); } /** diff --git a/tests/data/Calculation/Functions/IF_CONDITION.php b/tests/data/Calculation/Functions/IF_CONDITION.php index 0b510ed9ec..0ac81d5d2e 100644 --- a/tests/data/Calculation/Functions/IF_CONDITION.php +++ b/tests/data/Calculation/Functions/IF_CONDITION.php @@ -33,4 +33,12 @@ '<>"< PLEASE SELECT >"', '<>< Please Select >', ], + [ + '<>""', + '<>', + ], + [ + '=""', + '""', + ], ];