Bug 80195 - EDITING: IFERROR() fails to evaluate to alternative value (2nd parameter)
Summary: EDITING: IFERROR() fails to evaluate to alternative value (2nd parameter)
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.0.6.2 release
Hardware: Other All
: medium normal
Assignee: Eike Rathke
URL:
Whiteboard: BSA target:4.4.0 target:4.2.6 target:...
Keywords:
: 81240 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-06-18 15:48 UTC by Paál Balázs
Modified: 2014-09-12 20:40 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
example that demonstrates the bug (25.66 KB, application/vnd.oasis.opendocument.spreadsheet)
2014-06-18 15:48 UTC, Paál Balázs
Details
more complete testcase document (27.73 KB, application/vnd.oasis.opendocument.spreadsheet)
2014-07-10 14:13 UTC, Eike Rathke
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paál Balázs 2014-06-18 15:48:11 UTC
Created attachment 101315 [details]
example that demonstrates the bug

Problem description:

A cell containing an IFERROR() formula does not evaluate to the specified "alternative value" under certain conditions. In the example, the test expression (first parameter of IFERROR()) is itself an expression built with IF(). The inner IF has a condition that cannot be evaluated.

Placing the (inner, failing) IF() expression and the (outer) IFERROR() expressions in separate cells produces correct result - "alternative value" specified on 2nd parameter of IFERRROR() is returned.

However, if the two cells are merged into a single expression (instead of a reference to the IF() formula, it is copied verbatim inside the IFERROR() formula), the IFERROR does not return the "alternative value", but an error (which is exactly the opposite of why it has been used in the first place - to avoid an error in a cell).

Steps to reproduce:
1. open a new sheet
2. place the following formula in any cell: =IFERROR(IF("foo"+1<=1,0,1),"alternative value")
3. observe the result of the formula

Current behavior:
The formula returns an error

Expected behavior:
The formula should return "alternative value"

Example sheet:
The attached example also shows that if the two formulas are placed into separate cells (i.e. the failing IF() is in a cell, and the IFERROR is in another cell that references the first one), then the IFERROR produces a correct value.
However, in a single expression, IFERROR produces incorrect value.
Operating System: Ubuntu
Version: 4.2.3.3 release
Comment 1 Paál Balázs 2014-06-18 15:55:31 UTC
It seems that the bug is always present whenever the formula inside iferror has any problems, that is, the bug is not related to IF().

The simpler formula:  =IFERROR(0/0,"alternative value") also demonstrates the bug.
Comment 2 m_a_riosv 2014-06-18 21:38:17 UTC
Hi Paál, thanks for reporting.

Reproducible with sample file:
Win7x64Ultimate
Version: 4.0.6.2 (Build ID: 2e2573268451a50806fcd60ae2d9fe01dd0ce24)
Version: 4.1.6.2 Build ID: 40ff705089295be5be0aae9b15123f687c05b0a
Version: 4.2.3.3 Build ID: 882f8a0a489bc99a9e60c7905a60226254cb6ff0
Version: 4.3.0.1.0+ Build ID: e9ef07ed691399119b6bc5f1d2d79222667766c6
   TinderBox: Win-x86@42, Branch:libreoffice-4-3, Time: 2014-06-18_10:37:56
Version: 4.4.0.0.alpha0+ Build ID: 836454d0c1a490066f12cbe6327422ffb1065426
   TinderBox: Win-x86@39, Branch:master, Time: 2014-06-18_05:57:47

The function was implemented in 4.0, seems this issue has been there from the beginning.
Comment 3 Julien Nabet 2014-06-18 22:04:02 UTC
Winfried: one for you?
Comment 4 Winfried Donkers 2014-06-19 06:06:09 UTC
(In reply to comment #1)
> It seems that the bug is always present whenever the formula inside iferror
> has any problems, that is, the bug is not related to IF().
> 
> The simpler formula:  =IFERROR(0/0,"alternative value") also demonstrates
> the bug.

With version 4.2.5 the formula =IFERROR(0/0,"alternative value") works OK.
The formula =IFERROR(IF("foo"+1<=1,0,1),"alternative value") does not work OK in 4.2.5 nor in master.

I will look into it.
Comment 5 Paál Balázs 2014-06-19 10:05:13 UTC
(In reply to comment #4)

> With version 4.2.5 the formula =IFERROR(0/0,"alternative value") works OK.

Yeah, my mistake. I dont't know what happened.
Ignore comment #1
=IFERROR(0/0,"alternative value") works fine on 4.2.3.3 (Ubuntu 14.04 LTS version).
Comment 6 Eike Rathke 2014-07-10 14:13:25 UTC
Created attachment 102544 [details]
more complete testcase document
Comment 7 Commit Notification 2014-07-10 14:20:26 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=1093b900b43d819c9a730ef6435fed0f3687a085

resolved fdo#80195 act on implicitly propagated error, if any



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 8 Eike Rathke 2014-07-10 14:42:17 UTC
Pending review
for 4-3-0 at https://gerrit.libreoffice.org/10195
for 4-3 at https://gerrit.libreoffice.org/10196
for 4-2-6 at https://gerrit.libreoffice.org/10199
for 4-2 at https://gerrit.libreoffice.org/10198
Comment 9 Commit Notification 2014-07-10 16:26:26 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-4-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=50b9fe07f9851160e12922feb7d96d6f7ae5b52e&h=libreoffice-4-2

resolved fdo#80195 act on implicitly propagated error, if any


It will be available in LibreOffice 4.2.7.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 10 Commit Notification 2014-07-10 16:26:41 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-4-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=be91c2086afef99dc9569ac6aa4835c5072bffdf&h=libreoffice-4-3

resolved fdo#80195 act on implicitly propagated error, if any


It will be available in LibreOffice 4.3.1.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 11 Commit Notification 2014-07-14 08:31:03 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-4-3-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=85ad903b57d1d1362f0d9a64ca3de37606645dee&h=libreoffice-4-3-0

resolved fdo#80195 act on implicitly propagated error, if any


It will be available already in LibreOffice 4.3.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 12 Commit Notification 2014-07-14 20:59:52 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-4-2-6":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=874859a8feb8cfadd7f491ebae99ff8aa5fd43c7&h=libreoffice-4-2-6

resolved fdo#80195 act on implicitly propagated error, if any


It will be available already in LibreOffice 4.2.6.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 13 Modestas Vainius 2014-09-12 20:40:19 UTC
*** Bug 81240 has been marked as a duplicate of this bug. ***