How to search for text in LibreOffice Calc
This post describes how to search for text in LibreOffice Calc cells/columns and perform some subsequent calculations on cells in the same row. It is primarily a reminder for myself, to ensure I don't always have to search for ODS files where I last used this formula.
Basically what it does is SEARCH for a string in a cell.
If it finds the string the return value of SEARCH is 1.
If it fails to find the string the return value is #VALUE!.
To catch the error I use the ISERROR function and since ISERROR return FALSE when we actually found the string I need to invert the boolean using NOT.
=NOT(
ISERROR(
SEARCH(
"example",
$D11
)
)
)
I usually use this search formula to perform some math on related rows, so if I search for multiple strings I can combine these fields with an OR.
The following formula allows me to search combine three text searches for the subsequent calculation.
=IF(
OR(
J2:L2
),
$B2 * 24,
0
)