Skip to content

COUNTA counts wrong if called with multiple arguments #4558

@SlowFox71

Description

@SlowFox71

COUNTA(B1,B2,B3,B4) should count each cell which is not NULL. In this case, however, the function is passed an argument

array(4) {
    [0] => NULL
    [1] => NULL
    [2] => NULL
    [3[ => NULL
}

and when examined, each index is treated as not a cell value by Functions::isCellValue() (because it lacks two dots) and thus counted by COUNTA(). While Excel evaluates the expression above to 0 (if all cells are empty), PhpSpreadsheet (4.5.0) returns 4.

I did not check, but COUNT will most likely suffer from the same problem.

test.xlsx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions