[Libreoffice-bugs] [Bug 99613] optional Paramaters for IF is optional

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Tue Oct 6 22:37:37 UTC 2020


https://bugs.documentfoundation.org/show_bug.cgi?id=99613

--- Comment #8 from Travis Stewart <tstewart.writer at gmail.com> ---
I am not sure if I understand the original bug correctly, but I think there is
an actual issue with the documentation or the IF function. The Logical
Functions help page
(https://help.libreoffice.org/7.0/en-US/text/scalc/01/04060105.html?&DbPAR=WRITER&System=UNIX)
talks about optional parameters using a hypothetical 4 parameter function.

"In the LibreOffice Calc functions, parameters marked as "optional" can be left
out only when no parameter follows. For example, in a function with four
parameters, where the last two parameters are marked as "optional", you can
leave out parameter 4 or parameters 3 and 4, but you cannot leave out parameter
3 alone."

By applying this example to the IF function, where parameters 2 and 3 are
optional, you can use it with all 3 parameters included or with parameters 1
and 2 only, but you can't use it with parameters 1 and 3 with 2 left out.

This is the expected behaviour:
=IF(A1>5,100,"too small") is valid. If A1 <= 5 it returns "too small" otherwise
it returns 100.
=IF(A1>5,100) is also valid. It returns 100 if A1 > 5 is TRUE, and FALSE
otherwise. Parameter 3 is left out, but that's okay because no parameter
follows it.
=IF(A1>5, , "too small") is invalid because you can only leave out optional
parameters if no parameters follow. But in this case, the optional parameter 2
is left out and followed by a parameter. You'd expect an error, it shouldn't
work based on the statement in the documentation.

But you can leave out parameter 2 and it still does something, even though the
documentation says it can't be left out.
=IF(A1>5, , "too small"), A1 > 5 it returns 0, if it is <= 5, it returns "too
small"

If the documentation is correct, it should not interpret an empty parameter as
a 0 and use that as the ThenValue. If the documentation is wrong, then how it
handles empty parameters needs to be discussed in the documentation.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20201006/9127c62b/attachment.htm>


More information about the Libreoffice-bugs mailing list