Inconsistent IF behaviour with #N/A as first parameter

The best way to explain my problem is to show the results of 2 different formulas:
=IF(NA();1;2)
Result: #N/A as expected
=IF(NA();1;IFERROR(NA();2))
Result: 2

Shouldn’t the NA() as the first parameter propagate? Why does it still evaluate the “On false” parameter in the second formula?

Version information:
Version: 7.2.4.1 / LibreOffice Community
Build ID: 20(Build:1)
CPU threads: 16; OS: Linux 5.14; UI render: default; VCL: kf5 (cairo+xcb)
Locale: nl-NL (en_US.UTF-8); UI: en-US
7.2.4-1
Calc: threaded

Background: I created a basic formula evaluator and was verifying whether the cell output of a big spreadsheet I use is the same between LibreOffice Calc and my formula evaluator, and found this. In this specific case I don’t understand how it’s supposed to work, so I can’t make them produce the same results.

Thanks in advance!

Here, “basic” mean simple?

IFNA function, could be of help here?

Yes, basic in the sense of simple. I didn’t mean the language :slight_smile:

And thanks, but in this case my problem is not that I need to achieve a certain output, it’s that I need to understand why it does this. This behavior is not as I would expect it, and thus I don’t know how to program my evaluator to follow the same logic (for full compatibility).

After reading through the OpenDocument recalculated formula specification a bit more, I ended up filing a bug report, since from what I understand of it, it does not seem to behave like the specification would suggest it should behave.

Share the bug report number here, like tdf#nnnnnn (nnnnnn is the bug real number). Thanks.

Bug report
tdf#146377

1 Like