Ask Your Question

How to debug 'Wrong data type' problem (`SEARCH` function) ?

asked 2018-06-20 16:25:58 +0200

I'm using LO Calc x64 on Window$ 7 Enterprise SP1 x64.

Even when I create a new spreadsheet and regardless of whether the cell referenced by SEARCH is formatted to be text or a number, I always get the Wrong data type error.

In Untitled 2.ods L2 uses a RegEx version, L3 a wildcard version and L4 a normal version.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2018-06-21 11:28:11 +0200

pierre-yves samyn gravatar image


SEARCH returns #VALUE! when the text is not found.

To avoid this, use the IFERROR function

=IF(IFERROR(SEARCH(".*destroyer.*";$A2);0)>0;1;  IF(IFERROR(SEARCH(".*cruiser.*"  ;$A2);0)>0;5;  IF(IFERROR(SEARCH(".*battle.*"   ;$A2);0)>0;15;  IF(IFERROR(SEARCH(".*mother.*"   ;$A2);0)>0;40))))

HTH - Regards

edit flag offensive delete link more


But if it didn't find the text, why give Wrong data type ?

rautamiekka gravatar imagerautamiekka ( 2018-06-21 14:12:33 +0200 )edit


AFAIK No result = #VALUE (in the cell rather than Err:519!)

See help

Just for information, the function returns the same thing with Excel. Returning zero could make the function ambiguous (could be interpreted as a position)?


pierre-yves samyn gravatar imagepierre-yves samyn ( 2018-06-21 16:23:57 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-06-20 16:25:58 +0200

Seen: 797 times

Last updated: Jun 21 '18