How can I use Google Sheets to check if a cell contains text from a list? 2

How can I use Google Sheets to check if a cell contains text from a list?

Google Sheets is a powerful tool that allows users to organize and analyze data in a spreadsheet format. One useful feature of Google Sheets is the ability to check if a cell contains text from a predefined list. This can be done by using the “COUNTIF” function, which counts the number of occurrences of a specific text in a range of cells. By specifying the predefined list as the range and the cell to be checked as the criteria, the function will return a value of “1” if the cell contains text from the list, or “0” if it does not. This allows users to quickly and efficiently check for the presence of specific text in a cell, saving time and effort in data analysis.

Google Sheets: Check if Cell Contains Text from List


You can use the following formula in Google Sheets to check if a cell contains text from a list:

=ArrayFormula(IF(LEN(A2:A13), REGEXMATCH(A2:A13,".*(?i)("&TEXTJOIN("|",
TRUE,$E$2:$E$4)&").*") ,""))

In this example, if cell A1 contains any of the text values in the range E2:E8 then it will return TRUE, otherwise it will return FALSE.

The following example shows how to use this formula in practice.

Example: Check if Cell Contains Text from List in Google Sheets

Suppose we have the following dataset in Google Sheets that shows the number of points scored by various basketball players:

There are three teams in the list from Texas: Mavs, Spurs, and Rockets.

Suppose we’d like to create a new column that tells us whether each team is from Texas or not.

First, we’ll create a list of the Texas teams in column E:

Then we’ll use the following formula to check if the value in the Team column contains any of the text values in column E:

=ArrayFormula(IF(LEN(A2:A13), REGEXMATCH(A2:A13,".*(?i)("&TEXTJOIN("|",
TRUE,$E$2:$E$4)&").*") ,""))

We can type this formula into cell C2 and then copy and paste it down to the remaining cells in column C:

Google Sheets check if cell contains text from list

Notice that any row that contains Mavs, Spurs, or Rockets receives a value of TRUE while all other rows receive a value of FALSE.

For example:

  • The first row received a value of TRUE since “Mavs” is in the list.
  • The second row received a value of FALSE since “Nets” is not in the list.
  • The third row received a value of TRUE since “Mavs” is in the list.
  • The fourth row received a value of FALSE since “Lakers” is not in the list.

And so on.

The following tutorials explain how to perform other common tasks in Google Sheets:

Cite this article

stats writer (2024). How can I use Google Sheets to check if a cell contains text from a list?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-use-google-sheets-to-check-if-a-cell-contains-text-from-a-list/

stats writer. "How can I use Google Sheets to check if a cell contains text from a list?." PSYCHOLOGICAL SCALES, 25 Jun. 2024, https://scales.arabpsychology.com/stats/how-can-i-use-google-sheets-to-check-if-a-cell-contains-text-from-a-list/.

stats writer. "How can I use Google Sheets to check if a cell contains text from a list?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-use-google-sheets-to-check-if-a-cell-contains-text-from-a-list/.

stats writer (2024) 'How can I use Google Sheets to check if a cell contains text from a list?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-use-google-sheets-to-check-if-a-cell-contains-text-from-a-list/.

[1] stats writer, "How can I use Google Sheets to check if a cell contains text from a list?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.

stats writer. How can I use Google Sheets to check if a cell contains text from a list?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.

Download Post (.PDF)
Slide Up
x
PDF
Scroll to Top