Skip to content

SUM Function is Partially Broken #2042

@oleibman

Description

@oleibman

This is:

- [x] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)

What is the expected behavior?

In Excel, =SUM(5.7, "x", 30) returns #VALUE. However, if A1/A2/A3 contain 5.7, x, and 30, =SUM(A1:A3) returns 35.7. With the recent re-factoring of MathTrig, both formulas evaluate to #VALUE. @MarkBaker and @PowerKiKi, I have no idea how to distinguish the 2 situations from each other in the code. It would, of course, be easy to change so that both returned 35.7, which is probably better.

What is the current behavior?

All samples using template sampleSpreadsheet.php are affected. When writing those samples as Xlsx, Xls, and Ods, they nevertheless appear okay on open because Excel etc. re-evaluate the function. However, writing those samples to Csv, Html, or Pdf will show #VALUE! when a number is expected.

What are the steps to reproduce?

Please provide a Minimal, Complete, and Verifiable example of code that exhibits the issue without relying on an external Excel file or a web server:

After running the sample suite, 16_Csv.csv and 17_Html.html demonstrate this problem.

Which versions of PhpSpreadsheet and PHP are affected?

Master.

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