# Show a value if a text cell includes a specific string [closed]

Processing a bank statement. Trivial problem.

I'm trying to show a copy of the 'In' amount in a different column if the corresponding description contains a specific string (such as 'Interest'). These can then give a column total of all 'Interest' rows.

I would expect IF(SEARCH("Interest", D6, 1) > 0, F6, "")

(for row 6 where the description is in column D and the 'In' payments are in column F) to work, but on the rows where 'Interest' is not found, the cell shows '#VALUE!'. I guess that the SEARCH function does not return a numeric value if a match isn't found, but the documentation doesn't say what is returned so I can't allow for it.

How to achieve this?

Been a programmer for nearly 50 years, but of course a spreadsheet function isn't a programming function.

David

Many thanks to Lupp and Earnest Al. ISNUMBER solves the problem.

edit retag reopen merge delete

### Closed for the following reason the question is answered, right answer was accepted by David G L close date 2021-01-12 16:56:12.113873

( 2021-01-10 21:32:47 +0100 )edit

Does question 282269 help?

( 2021-01-10 21:36:25 +0100 )edit

Sort by » oldest newest most voted

As opposed to the usage of searching functions in general programming (also the InStr() function e.g. in LibreOffice Basic) the searching Calc functions don't return a 0 (zero) if no match was found, but an error.
You therefore need to use =IF(ISNUMBER(SEARCH("Interest"; D6)); F6;"") instead of what you tried. Unfortunately help texts seem to not expose this clearly.

(editing a bit later)
Just for fun. And because there are doubts concerning the reliability of any pulling to rubrics based on a few keywords. I always chose the rubric for any transaction manually in my bank-account data.