Google Sheets Text Contains: A Practical Guide

Learn to detect substrings in Google Sheets using FIND, SEARCH, and REGEXMATCH with practical formulas, examples, and common pitfalls.

How To Sheets
How To Sheets Team
·5 min read
Quick AnswerDefinition

According to How To Sheets, you can detect substrings in a cell with FIND or SEARCH, or with REGEXMATCH for patterns. A simple test is =ISNUMBER(SEARCH("term", A2)), which returns TRUE when the term appears. For more complex patterns, REGEXMATCH(A2, "pattern") yields TRUE or FALSE. You can extend tests with ARRAYFORMULA for column-wide checks.

What google sheets text contains means in practice

The concept of text containment in Google Sheets centers on detecting whether a cell's content includes a given substring. This is essential for data validation, cleaning, and dynamic filtering. In this guide, the keyword google sheets text contains will appear frequently as you learn practical formulas, patterns, and edge cases. Below you'll find several approaches, starting with simple searches and moving to robust pattern matching.

Excel Formula
=ISNUMBER(SEARCH("sales", A2))

This formula returns TRUE when the substring is found in A2. Unlike FIND, SEARCH is case-insensitive, which is convenient for quick checks across mixed-case text. If you want a strict yes/no, wrap the result in IF:

Excel Formula
=IF(ISNUMBER(SEARCH("sales", A2)), TRUE, FALSE)

Why this matters: being able to test containment enables conditional formatting, filtering, and automated data auditing across large datasets. As you progress, you’ll replace hard-coded literals with cell references and leverage ARRAYFORMULA for column-wide checks.

Excel Formula
=ARRAYFORMULA(ISNUMBER(SEARCH("sales", A2:A)))

For straightforward substring checks, FIND and SEARCH are the quickest tools. FIND is case-sensitive, while SEARCH ignores case. This distinction matters when your data includes mixed-case entries. The following examples illustrate typical usage and how to handle missing results without breaking your formulas.

Excel Formula
=ISNUMBER(FIND("Sales", A2))

This returns TRUE only if A2 contains the exact case "Sales". To avoid #VALUE! errors when the substring isn't present, use IFERROR:

Excel Formula
=IFERROR(ISNUMBER(FIND("Sales", A2)), FALSE)

For case-insensitive matching across a whole column, you can combine with ARRAYFORMULA:

Excel Formula
=ARRAYFORMULA(ISNUMBER(SEARCH("sales", A2:A)))

Pattern Matching with REGEXMATCH

REGEXMATCH offers flexible, pattern-based containment. It can handle multiple terms, boundaries, and optional groups. Use it when you need to detect one of several substrings, or when the text structure is predictable. Note that REGEXMATCH returns TRUE or FALSE and requires a valid regular expression.

Excel Formula
=REGEXMATCH(A2, "(sales|budget|invoice)")

To apply across a range, wrap with ARRAYFORMULA:

Excel Formula
=ARRAYFORMULA(REGEXMATCH(A2:A, "(sales|budget|invoice)") )

If you want a case-insensitive match, you can add (?i):

Excel Formula
=REGEXMATCH(A2, "(?i)sales|budget|invoice")

Extracting or Counting Matches

Beyond boolean tests, you can extract the matched text with REGEXEXTRACT or count occurrences with a small formula. REGEXEXTRACT pulls the first matching substring, which is useful for parsing semi-structured data.

Excel Formula
=REGEXEXTRACT(A2, "(sales|budget|invoice)")

Counting occurrences of a term within a cell can be done via length tricks with SUBSTITUTE:

Excel Formula
=IFERROR((LEN(LOWER(A2)) - LEN(SUBSTITUTE(LOWER(A2), "sales", ""))) / LEN("sales"), 0)

For multiple cells, use ARRAYFORMULA:

Excel Formula
=ARRAYFORMULA(REGEXEXTRACT(A2:A, "(sales|budget|invoice)") )

Practical workflow: testing on real data

Let's test with a small sample and show how to audit results. Suppose you have a column A with product descriptions. We'll create a helper column B that flags whether the description contains any of several keywords and another column C that extracts the matched keyword.

Excel Formula
=REGEXMATCH(A2, "(?i)\\b(sales|budget|invoice)\\b")
Excel Formula
=REGEXEXTRACT(A2, "(?i)\\b(sales|budget|invoice)\\b")

To apply to entire column and keep things fast, use ARRAYFORMULA in the header row:

Excel Formula
=ARRAYFORMULA(IF(A2:A="",, REGEXMATCH(A2:A, "(?i)\\b(sales|budget|invoice)\\b")))

Common pitfalls and debugging tips

Containment formulas can fail for various reasons: case sensitivity, escaping special characters in regex patterns, or trailing spaces. Start by testing simple checks in a single cell, then expand using ARRAYFORMULA. Use TRIM to remove stray spaces and LOWER/UPPER to standardize case. Always handle errors with IFERROR to avoid noisy results.

Excel Formula
=IFERROR(SEARCH("sales", TRIM(A2)), 0)

If you need a literal regex, remember to escape backslashes in quotes:

Excel Formula
=REGEXMATCH(A2, "\\bSales\\b")

Performance tips and best practices

When working with large sheets, avoid heavy regex across entire columns; pre-filter data with simpler criteria, or run expensive tests sparingly using FILTER or QUERY. Cache results in a helper column and reference it in downstream formulas. If you must scan many cells, prefer REGEXMATCH with direct pattern rather than multiple FIND calls.

Excel Formula
=ARRAYFORMULA(REGEXMATCH(A2:A, "(?i)\\b(sales|budget|invoice)\\b"))

Good optimization practice includes converting boolean results to text with IF to produce friendly labels, e.g., "Found"/"Not Found".

Appendix: quick reference formulas

  • Case-sensitive contains (FIND):
Excel Formula
=ISNUMBER(FIND("Sales", A2))
  • Case-insensitive contains (SEARCH):
Excel Formula
=ISNUMBER(SEARCH("sales", A2))
  • Pattern match with REGEXMATCH:
Excel Formula
=REGEXMATCH(A2, "(?i)\b(sales|budget)\b")
  • Extract first match:
Excel Formula
=REGEXEXTRACT(A2, "(?i)\b(sales|budget|invoice)\b")

Steps

Estimated time: 15-25 minutes

  1. 1

    Plan your pattern

    Identify the target column and the keywords or patterns you want to detect. Decide whether you need a strict contains check or a flexible pattern. Prepare a small sample dataset to validate your formulas before applying to the whole sheet.

    Tip: Start with a single cell test before scaling to a column.
  2. 2

    Choose the right test

    Use FIND for exact case-sensitive matches, or SEARCH for case-insensitive checks. For multiple terms, REGEXMATCH is often easier and more scalable.

    Tip: Remember: FIND is case-sensitive, while SEARCH is not.
  3. 3

    Handle errors gracefully

    Wrap tests in IFERROR to avoid #VALUE! or #N/A errors when a substring isn’t found. This keeps downstream formulas clean.

    Tip: IFERROR is your friend when dealing with optional matches.
  4. 4

    Scale to a range

    Apply the test across a range with ARRAYFORMULA to produce a TRUE/FALSE array for an entire column.

    Tip: Use REGEXMATCH with ARRAYFORMULA for patterns across columns.
  5. 5

    Extract or count matches

    If you need the actual matched text, use REGEXEXTRACT; for counts, combine LEN and SUBSTITUTE with lowercased text to count occurrences.

    Tip: REGEXEXTRACT returns the first match; for multiple matches, consider iterative approaches.
  6. 6

    Validate with real data

    Test formulas on realistic data, check edge cases (empty cells, special characters), and refine patterns accordingly.

    Tip: Document your patterns so others can reuse them.
Pro Tip: When using REGEXMATCH, anchor patterns with word boundaries to avoid partial matches.
Warning: Regex patterns can fail on unusual characters; escape backslashes in strings for Sheets.
Note: Cache results in a helper column to improve performance on large sheets.

Prerequisites

Required

Optional

  • Familiarity with relative vs absolute references in formulas
    Optional
  • A sample dataset to practice on
    Optional

Keyboard Shortcuts

ActionShortcut
Copy cellCopy the selected cellCtrl+C
Paste to multiple cellsPaste values only or use normal paste as neededCtrl++V
Find in sheetOpen Find dialog to search within the sheetCtrl+F
Fill downFill formula down a columnCtrl+D
Open Find and ReplaceSearch and replace text in rangeCtrl+H
Enter formulaEnter/accept formula in a cell

FAQ

What is the difference between FIND and SEARCH in Google Sheets?

FIND is case-sensitive, returning an error if the substring isn’t found. SEARCH ignores case, returning a number when found or an error otherwise. Use the one that matches your needs and wrap in IFERROR to handle misses.

FIND is case-sensitive, while SEARCH is not. Use IFERROR to handle missing substrings.

Can REGEXMATCH detect multiple substrings at once?

Yes. Use a pattern with alternation, like "sales|budget|invoice", to detect any of several terms. REGEXMATCH returns TRUE or FALSE for each cell.

Yes—REGEXMATCH can check for multiple terms using a pattern with | as an OR operator.

Is there a way to extract the actual matched text, not just a boolean?

Yes. REGEXEXTRACT returns the first matching substring. You can combine it with REGEXMATCH to validate and extract in one step.

You can pull out the matched text with REGEXEXTRACT.

How do I apply contains logic to an entire column efficiently?

Use ARRAYFORMULA with REGEXMATCH or SEARCH to generate a boolean array for the entire column. This avoids copying formulas down many rows.

Apply it once with ARRAYFORMULA to cover the whole column.

Why do I sometimes get #VALUE! with FIND or SEARCH?

This occurs when the substring isn’t found. Use IFERROR to provide a default value or FALSE. Trim inputs to avoid stray spaces.

If not found, you’ll see an error—use IFERROR to handle it gracefully.

Does Google Sheets have a dedicated 'text contains' function?

No. Most use FIND/SEARCH or REGEXMATCH to implement a contains check with more flexibility and pattern support.

There isn't a separate contains function; use FIND/SEARCH or REGEXMATCH instead.

The Essentials

  • Test contains with FIND/SEARCH
  • Prefer REGEXMATCH for complex patterns
  • Wrap tests with IFERROR to avoid errors
  • Use ARRAYFORMULA for column-wide checks
  • REGEXEXTRACT can fetch matched text

Related Articles