You can use the following formula in Google Sheets to determine if a cell contains a certain string:

=IF(REGEXMATCH(B1, "this"), 1, 0)

In this example, if cell B1 contains the string “this” then it will return a **1**, otherwise it will return a **0**.

The following examples show how to use this formula in practice.

**Related: **Google Sheets: A Simple Formula for “If Not Empty”

**Example 1: Use “If Contains” For One String**

The following formula shows how to create a new column that returns a **1** if the team name is equal to Lakers and a **0** if the team name is not equal to Lakers:

Note that you can also return string values such as “Yes” or “No” instead of numeric values:

**Example 2: Use “If Contains” For One of Several Strings**

The following formula shows how to create a new column that returns a **1** if the team name is equal to Lakers *or* Mavericks and a **0** if the team name is something else:

**Additional Resources**

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

Google Sheets: How to Use IFERROR Then Blank

Google Sheets: How to Use IF Statement with MATCH Function

Google Sheets: How to Use VLOOKUP with COUNTIF

If you’re trying to determine if the cell content matches exactly what you’re looking for, why would you not simply use the IF function? =IF(B2=”Lakers”, 1,””)

Seems to me CONTAINS is valuable if the cell content might be “L.A. Lakers” or something like that…

Am I missing something?