PhpSpreadsheet/tests/data/Calculation
Owen Leibman 4f6d4af396
Save Excel 2010+ Functions Properly
For functions introduced in Excel 2010 and beyond, Excel saves them
in formulas with the xlfn_ prefix. PhpSpreadsheet does not do this;
as a result, when a spreadsheet so created is opened, the cells
which use the new functions display a #NAME? error.
This the cause of bug report 1246:
https://github.com/PHPOffice/PhpSpreadsheet/issues/1246
This change corrects that problem when the Xlsx writer encounters
a 2010+ formula for a cell or a conditional style. A new class
Writer/Xlsx/Xlfn, with 2 static methods,
is introduced to facilitate this change.

As part of the testing for this, I found some additional problems.
When an unknown function name is used, Excel generates a #NAME? error.
However, when an unknown function is used in PhpSpreadsheet:
  - if there are no parameters, it returns #VALUE!, which is wrong
  - if there are parameters, it throws an exception, which is horrible
Both of these situations will now return #NAME?
Tests have been added for these situations.

The MODE (and MODE.SNGL) function is not quite in alignment with Excel.
MODE(3, 3, 4, 4) returns 3 in both Excel and PhpSpreadsheet.
However, MODE(4, 3, 3, 4) returns 4 in Excel, but 3 in PhpSpreadsheet.
Both situations will now match Excel's result.
Also, Excel allows its parameters for MODE to be an array,
but PhpSpreadsheet did not; it now will.
There had not been any tests for MODE. Now there are.

The SHEET and SHEETS functions were introduced in Excel 2013,
but were not introduced in PhpSpreadsheet. They are now introduced
as DUMMY functions so that they can be parsed appropriately.

Finally, in common with the "rate" changes for which I am
creating a pull request at the same time as this one:
samples/Basic/13_CalculationCyclicFormulae
PhpUnit started reporting an error like "too much regression".
The test deals with an infinite cyclic formula, and allowed
the calculation engine to run for 100 cycles. The actual number of cycles
seems irrelevant for the purpose of this test. I changed it to 15,
and PhpUnit no longer complains.
2020-05-18 12:37:35 +09:00
..
DateTime Changes to WEEKNUM and YEARFRAC (#1316) 2020-02-19 20:22:31 +01:00
Engineering Refactor engineering tests (#1106) 2019-07-25 21:02:41 +02:00
Financial Fix RATE, PRICE, XIRR, and XNPV Functions (#1456) 2020-05-17 19:50:01 +09:00
Functions Fixed Functions->ifCondition for allowing <> and empty condition 2019-11-17 21:03:11 +01:00
Logical Fix IF implementation to comply with Excel behavior 2019-11-17 18:26:33 +01:00
LookupRef Merge branch 'master' into Further-Test-Refactoring 2019-09-20 16:04:36 -07:00
MathTrig Fix ROUNDUP and ROUNDDOWN for negative number 2020-04-27 17:03:07 +09:00
Statistical Save Excel 2010+ Functions Properly 2020-05-18 12:37:35 +09:00
TextData Upgrade to phpunit 7.5 2019-07-24 23:45:43 -07:00
Calculation.php Fix branch pruning resolution of non boolean conditions 2019-11-10 22:59:09 +01:00
FunctionsAsString.php MATCH with a static array should return the position of the found value based on the values submitted. 2020-04-26 22:09:31 +09:00