[Solved] Search and Replace Text

Discuss the spreadsheet application
Post Reply
Moon Lit Nights
Posts: 28
Joined: Sun Jan 31, 2016 6:44 am

[Solved] Search and Replace Text

Post by Moon Lit Nights »

Hi,

I am trying to search content in several cells (their info changes based on another cell) and would like to replace the original text with 1 [EDIT: or any other number other than 0] if the word is found and 0 if the word is not found. These numbers are then summed together. It's rough for me to put into words so I am attaching a sheet.

Any help would be greatly appreciated.
Last edited by Moon Lit Nights on Mon Apr 08, 2019 4:41 pm, edited 1 time in total.
OpenOffice 3.1 on Windows
FJCC
Moderator
Posts: 9271
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Search and Replace Text

Post by FJCC »

You can use a formula like

Code: Select all

=NOT(ISERROR(FIND("Hello";$B2)))
or

Code: Select all

=NOT(ISERROR(SEARCH("Hello";$B2)))
FIND() is case sensitive, SEARCH() is not.
These will return TRUE or FALSE. You can format the cells as integer numbers if you want to see 1 and 0 instead of TRUE and FALSE. TRUE has a value of 1 and FALSE has a value of 0, so the sum will work in either case.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Moon Lit Nights
Posts: 28
Joined: Sun Jan 31, 2016 6:44 am

Re: Search and Replace Text

Post by Moon Lit Nights »

Worked perfectly, thank you so very much!
OpenOffice 3.1 on Windows
Post Reply