Search function

If I use the function Search(“any text string”, A1) and cell A1 contains “Insert any text string here”, the function returns the number 8 as the starting position of the text I’ve searched for.

If the cell A1 contains “Insert any text tring here”, the search function returns #Value!

What am I doing wrong?

I’ve used Microsoft’s Excel for years and I’m trying to switch to LibreOffice.

Kind regards, Peter Smith.

Hello @Mannesty,

If the search pattern was not found in your cell A1, then the SEARCH() function returns "#VALUE".
If you want a custom message in case the search pattern wasn’t found, then you could use the IFERROR() function like this:

=IFERROR( SEARCH("any text string",A1),"<Not Found>")

HTH, lib

Thanks for your reply.

The actual formula that works in Excel but not in LibreOffice Calc is IFERROR(IF(SEARCH(“Redexis Gas Murcia”,$F16)>0,$Q16,$R16),"")

I’ve now rewritten it to work in LibreOffice Calc.

Thanks for your help.

It sounds like this answered your question, so please mark the answer as correct. See guidelines for asking.