Bug 151426 - Feature request: extend IFERROR/IFNA to other predicates
Summary: Feature request: extend IFERROR/IFNA to other predicates
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard: QA:needsComment
Keywords:
Depends on:
Blocks: Calc-Function
  Show dependency treegraph
 
Reported: 2022-10-08 14:30 UTC by Jeffrey Tsang
Modified: 2022-11-03 03:35 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeffrey Tsang 2022-10-08 14:30:32 UTC
Description:
One great feature of LibreOffice over OpenOffice is the existence of IFERROR and ISNA.

The documentation notes: `=IFERROR(X; Y)` is semantically equivalent to `=IF(ISERROR(X); Y; X)`, except that the former case is more efficient because `X` is only computed once.

This is an extremely common use pattern that is not limited to errors - it's providing a default value when the result doesn't fit an expected type.

I have personal use cases for the equivalent of IFBLANK, IFNONTEXT, IFNONNUMBER, and these shouldn't be too difficult to implement, giving a real performance (and readability) benefit.

In a different direction, the complete generalization is validate-or-default, which takes three arguments:

`VALIDATE(PRED, X, Y) === IF(PRED(X),X,Y)`

which guarantees X is evaluated once. This would subsume all of the above and then some, provided function references exist.

Actual Results:
 

Expected Results:
 


Reproducible: Always


User Profile Reset: No



Additional Info: