Open stellarore opened 6 years ago
It would be the same error if the known_xs were all the same number, not necessarily just zero. For all these cases, it's trying to calculate the slope/intercept of a vertical line.
An easier way to test that, would be (with PhpSpreadsheet, but it's mostly same):
var_dump(\PhpOffice\PhpSpreadsheet\Calculation\Statistical::SLOPE([1, 1], [1, 1]));
Would you consider creating a PR for that against PhpSpreadsheet develop branch ?
I have a row of cells (B2:F2) that sometimes could be all zero. They are being used as the "known_xs" in =SLOPE(known_ys,known_xs) and =INTERCEPT(known_ys,known_xs) . The "known_ys" (B1:F1) are arbitrary numbers (can be 0, positive, or negative).
Excel gives the expected '#DIV/0!'. PHPExcel gives:
Same issue if I try to use =IF(COUNTIF( ) ) to avoid the error.