Bug 151426

Summary: Feature request: extend IFERROR/IFNA to other predicates
Product: LibreOffice Reporter: Jeffrey Tsang <obscurans>
Component: CalcAssignee: Not Assigned <libreoffice-bugs>
Status: UNCONFIRMED ---    
Severity: enhancement CC: 79045_79045, himajin100000
Priority: medium    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard: QA:needsComment
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 108827    

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: