Support numeric condition in SUMIF, SUMIFS, AVERAGEIF, COUNTIF, MAXIF and MINIF
Fixes #683 Fixes #701
This commit is contained in:
parent
90bb4df777
commit
ed6a3a0148
|
@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Support numeric condition in SUMIF, SUMIFS, AVERAGEIF, COUNTIF, MAXIF and MINIF [#683](https://github.com/PHPOffice/PhpSpreadsheet/issues/683)
|
||||
|
||||
## [1.5.0] - 2018-10-21
|
||||
|
||||
### Added
|
||||
|
|
|
@ -267,7 +267,7 @@ class Functions
|
|||
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], ['>', '<', '='])) {
|
||||
|
|
|
@ -70,5 +70,28 @@ return [
|
|||
[10],
|
||||
],
|
||||
],
|
||||
|
||||
[
|
||||
100,
|
||||
[
|
||||
['0'],
|
||||
['some text'],
|
||||
],
|
||||
0, // Compare integer with string
|
||||
[
|
||||
[100],
|
||||
[1],
|
||||
],
|
||||
],
|
||||
[
|
||||
100,
|
||||
[
|
||||
[0],
|
||||
['some text'],
|
||||
],
|
||||
0, // Compare integer with integer
|
||||
[
|
||||
[100],
|
||||
[1],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue