Ask Your Question
0

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

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

I'm using LO Calc 6.0.4.2 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
2

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

pierre-yves samyn gravatar image

Hi

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

Comments

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

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

@rautamiekka

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)?

Regards

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

Question Tools

1 follower

Stats

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

Seen: 271 times

Last updated: Jun 21 '18