Skip to playerSkip to main content
  • 2 months ago
Learn how to add a search bar with contains substring in Google sheet. We will also answer, how do you check if a string contains a substring in Google sheet and how do I sum a cell contains a substring in Google sheet. We'll also be addressing if there a contain function in Google sheet? And finally, how do I find cells containing string in Google Sheets?

Is there a contains function in Google Sheets?
Yes in a round about ways. You will have to use this formula.
=IF(REGEXMATCH(A1, "rabi"), 1, 0)
Returns 1 if cell A1 contains substring "rabi"

Look these are the steps outlined on the video.

Here's how you can create a search tool in Google Sheet, similar to this.

Regular Search Bar
1) Highlight data set
2) Format ~ Conditional Formatting
3) Custom formula is
4) =$A4=$B$1
5) Done

Partial Match Search Bar
1) Highlight data set
2) Format ~ Conditional Formatting
3) Custom formula is
4) =IF(AND(REGEXMATCH($A4, $B$1),NOT(ISBLANK($B$1))), 1, 0)
5) Done

Let's break down the formula shown below
=IF(AND(REGEXMATCH($A4, $B$1),NOT(ISBLANK($B$1))), 1, 0)

- REGEXMATCH($A4, $B$1) checks if the value in cell A4 matches the regular expression pattern in cell B1. It returns TRUE if there's a match and FALSE otherwise.
- ISBLANK($B$1) checks if cell B1 is empty. It returns TRUE if the cell is empty and FALSE if it contains any value.
- NOT(ISBLANK($B$1)) negates the result of ISBLANK($B$1). It returns TRUE if cell B1 is not empty and FALSE if it's empty.
- AND(REGEXMATCH($A4, $B$1), NOT(ISBLANK($B$1))) checks if both conditions are true using the logical AND operator. It returns TRUE if both conditions are true and FALSE otherwise.
- Finally, the IF function evaluates the result of the AND function. If the result is TRUE, it returns 1; otherwise, it returns 0.


How do you check if a string contains a substring in Google sheet?,How do I sum if a cell contains a substring in Google Sheets?,Is there a contains function in Google Sheets?,How do I find cells containing string in Google Sheets?,
Transcript
00:00Here is how you can create a search tool in Google Sheet similar to this.
00:04The first thing to do is to select all your data set except the header, all the way down
00:09to the very last one.
00:11Then you go Format, Conditional Formatting, and in here, you're going to change this to
00:16Custom Formula Is, and use this formula.
00:20Once that's done, click on Done, and then go all the way up here.
00:25And in your search tool box here, if you type Claire, and hit enter, you can see that any
00:31student name that has a Claire in it get highlighted like that.
00:35But this technique doesn't work too well if there's partial match.
00:39Let me show you what I mean by that.
00:40I'm going to delete Claire here.
00:42And let's say if I type T, as in Theodore, I do see Tay, Theodore, it does not really highlight
00:48any of those names which is partially matched.
00:51So the way to get around this, you're going to have to change the formula on your Conditional
00:54Formatting.
00:55Now place your cursor anywhere on your data set, and you should see your old formula that
01:00you have here.
01:01Click on it to expand it.
01:03Let's delete the old formula, and enter this new formula.
01:08After that, click on Done, and you can see anything starting with T is already highlighted.
01:16Let's do another test.
01:17Put a C in here, and hit enter.
01:19The case of the student name starting with C is highlighted.
01:26And in the case of the student name, starting with C, is highlighted.
Be the first to comment
Add your comment

Recommended