Google Sheets Query: How to Select Rows that Contain String(Quick & Easy Guide)

In this tutorial, you will learn How to Select Rows that Contain String using Google Sheets query

To Select Rows that Contain String in Google Sheets you can use the following query

=query(A1:C13, “select A, B C where B contains ‘String’“, 1)

The above query will Select Columns A and B within the provided cell range A1:C12 where Column B contains your provided string. The number 1 indicates that there is only one header row above the cell range.

Let’s see the above query with an example.

Google Sheets Query: How to Select Rows that Contain String

Enclosed are the steps to Select Rows that Contain String

Step 1: Open Google Sheets and Select the dataset

Choose the dataset in Google Sheets where you need to Select Rows that Contain a String.

In this example, we will use the following dataset.

Step 2: Now Choose the rows that contain a String

  • First Click on the Cell where you need to display the result
  • Now use the following syntax to choose all the rows which contain the string ‘Man’ in the Team Column and press enter

Note: Modify the query as per your dataset.

=QUERY(A1:C13, "SELECT A, B, C WHERE B CONTAINS 'Man'", 1)
Google Sheets Query: How to Select Rows that Contain String

The above query will return three rows that contain the String ‘Man’ in the Column Team Name.

#Select Rows in Google Sheets that Do Not Contain a String

You can use the below syntax to Select Rows in Google Sheets that do not contain the String ‘Man”

 =QUERY(A1:C13, "SELECT A, B, C WHERE NOT B CONTAINS 'Man'", 1)

The above query will return every row where the team name is not Manchester United.

#Select Rows in Google Sheets that Contain One of Several Strings

You can use the below syntax to Select Rows in Google Sheets that contain the string ‘Chel’ and ‘Man’ in the Column Team Name.

The following query returns only those rows where the team name is Manchester United or Chelsea.

=QUERY(A1:C13, "SELECT A, B, C WHERE B CONTAINS 'Man'or B CONTAINS 'Chel'", 1)

How to Select Rows that Contain String(Conclusion )

In the above tutorial, we have shown you examples using which you can Select Rows that Contain Strings in Google Sheets.

We hope this tutorial was helpful.

Related Posts :

How to Insert Spin Button in Google Sheets ( Easy Guide )

How to Freeze Rows in Google Sheets

How to Calculate Square Root and Cube Root in Google Sheets(Quick & Easy Guide)

How to use SUMSQ Function in Google Sheets(Quick & Easy Guide )