3 Commits

Author SHA1 Message Date
oleibman e1bcab6ca9 IF Empty Arguments
Fix #3875. Even better, fix #2146, which has been open for 2.5 years.

Empty arguments are improperly placed on the stack; in particular, they are added without `onlyIf` and `onlyIfNot` attributes.This results in problems described in 3875.

IF has a somewhat unexpected design. In Excel, `IF(false, valueIfTrue)` evaluates as `false`, but `IF(false, valueIfTrue,)` evaluates as 0. This means that IF empty arguments should be handled in the same manner as MIN/MAX/MINA/MAXA, but you need to be careful to distinguish empty from omitted.

Also note that IF requires 2 operands - `IF(true)` is an error, but `IF(true,)` evaluates to 0.
2024-01-27 07:34:37 -08:00
oleibman 73ee354d00 Update MissingArgumentsTest.php
Misplaced "middle missing" argument.
2024-01-16 15:45:28 -08:00
oleibman 0d6673dd8a Excel Inconsistent Handling of Empty Argument MIN/MAX/MINA/MAXA
Fix #3866. Excel normally treats a missing argument (e.g. `PRODUCT(2,3,)`) as null and ignores it. Not so for MIN/MAX/MINA/MAXA; for those, an empty argument is treated as zero. PhpSpreadsheet is changed to do the same.
2024-01-15 07:56:01 -08:00