Using SEARCH and FIND as criterion in COUNTIF [help request]

Hello!
I’m working on processing and graphing data from a user inputted calc spreadsheet and i ran into some issues with trying to count the cells that contain a specific string as part of their value,

Example:

User Hobbies
1 foo, bar
2 bar baz
3 foo, baz
4 bar
5 foo bar

So if i was trying to count the number of cells in the Hobbies column that had listed ‘bar’ as one of their hobbies I should get 4 cells I do not know how to do this. and help would be appreciated.
I want to try =COUNTIF(B:B; FIND( ???? ; "bar") >=1) but did not know how to pass a reference to the current cell COUNTIF was checking in as the source text.

Sorry if this has been answered before but with my limited googlefu skills i turned up nothing.

1 Like

Text format is better for search engines:

Method 1:
4=SUMPRODUCT(ISNUMBER(SEARCH(“Bar”, I3:I7)))

Method 2:
Enable Tools - Options - Libreoffice Calc - Calculate - Enable regular expressions in formulas and then

4=COUNTIF(I3:I17, “.Bar.”)

1 Like

This wonderful site has not only changed your quotes to typographical ones, but also used the asterix for formatting. So better enclose with backticks:
=SUMPRODUCT(ISNUMBER(SEARCH("Bar", I3:I7)))


=COUNTIF(I3:I17, ".*Bar.*")

2 Likes