Closed
Description
Sorry I don't use PhpSpreadsheet, but I found this bug in PHPExcel 1.8.1 and maybe it's in PhpSpreadsheet too.
I have .ods file which contains cell with formula FLOOR.MATH
But when I read this file and try to save to .xls I got exception:
Formula Error: Wrong number of arguments for FLOOR() function: 3 given, 2 expected
I found that:
FLOOR has 2 parameters https://support.office.com/en-us/article/floor-function-14bb497c-24f2-4e04-b327-b0b4de5a8886
FLOOR.MATH has 3 parameters https://support.office.com/en-us/article/floor-math-function-c302b599-fbdb-4177-ba19-2c2b1249a2f5
Perhaps there is a bug, and the FLOOR.MATH (with 3 parameters) is recognized as FLOOR (with 2 parameters)
Metadata
Metadata
Assignees
Labels
No labels
Activity
stale commentedon May 5, 2018
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If this is still an issue for you, please try to help by debugging it further and sharing your results.
Thank you for your contributions.
oleibman commentedon May 10, 2025
Ugh. Reluctantly reopening issue.
Per https://wiki.documentfoundation.org/Documentation/Calc_Functions/FLOOR:
Likewise, per https://wiki.documentfoundation.org/Documentation/Calc_Functions/CEILING:
In other words, using
FLOOR
orCEILING
is a trap if you intend to use OpenOffice/LibreOffice. You should strive to useFLOOR.MATH
orFLOOR.PRECISE
, whichever is most suitable; likewise for CEILING. And it seems like the MATH and PRECISE functions needs some special flourishes on write as well. Sigh. If I can figure out a way to document this better, or fix it, I will do so.Ods Handling of Ceiling and Floor