Bug 151426 - Feature request: IFBLANK, IFNONTEXT and IFNONNUMBER
Summary: Feature request: IFBLANK, IFNONTEXT and IFNONNUMBER
Status: NEW
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:
Keywords:
Depends on: Calc-Function-Requests
Blocks: Calc-Function
  Show dependency treegraph
 
Reported: 2022-10-08 14:30 UTC by Jeffrey Tsang
Modified: 2025-12-04 03:18 UTC (History)
3 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:
Comment 1 Olivier Hallot 2025-12-03 21:23:31 UTC
The suggested new functions could be addresses by 2 different implementations

- The LAMBDA function (not available in LibreOffice nor in ODFF 1.4 standard)
https://bugs.documentfoundation.org/show_bug.cgi?id=138749

- Implement as suggested.