Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Google Sheets Formula Contains: How to Use It

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To check whether a cell contains a piece of text in Google Sheets, use SEARCH or FIND inside ISNUMBER: for example, =ISNUMBER(SEARCH("apple", A1)) returns TRUE when A1 contains “apple” anywhere, in any case. That single pattern is the backbone of every “contains” formula you will build. This guide shows the exact formulas, how to use them in filters and conditional formatting, and how to avoid the errors that trip most people up.

What You'll Need

  • A Google account with access to Google Sheets (desktop browser or the mobile app).
  • A sheet with at least one column of text to test. The examples below assume your text is in column A starting at A1.
  • Basic familiarity with typing formulas and dragging the fill handle. No add-ons or paid features are required.

Step-by-Step

  1. Open your sheet and pick an empty cell next to the first row of text, for example B1. This is where the TRUE/FALSE result will appear.
  2. Type the basic contains formula. Enter =ISNUMBER(SEARCH("apple", A1)) and press Enter. If A1 is “Pineapple juice”, the result is TRUE; if A1 is “Banana”, it is FALSE. SEARCH ignores case, so “Apple” and “apple” both match.
  3. Copy the formula down the column. Click B1, grab the small square at the bottom-right corner (the fill handle), and drag down as far as your data goes. Each row now reports whether its text contains the word.
  4. Use a cell reference instead of hard-coded text. Put your search term in a separate cell, say D1, and change the formula to =ISNUMBER(SEARCH(D1, A1)). Now you can change D1 and every result updates. This is far easier to maintain than editing dozens of formulas.
  5. Switch to FIND if you need case sensitivity. Replace SEARCH with FIND: =ISNUMBER(FIND("Apple", A1)) returns TRUE only for an exact-case match. Use this when “Apple” the company must not match “apple” the fruit.
  6. Return custom text instead of TRUE/FALSE. Wrap the test in IF: =IF(ISNUMBER(SEARCH("apple", A1)), "Match", "No match"). This is useful when the result feeds a report or a dashboard.
  7. Test for multiple words at once. To flag a row that contains any of several terms, use SUMPRODUCT: =SUMPRODUCT(--ISNUMBER(SEARCH({"apple","pear","plum"}, A1)))>0. For an AND-style test (all terms present), multiply the individual tests: =AND(ISNUMBER(SEARCH("apple", A1)), ISNUMBER(SEARCH("juice", A1))).
  8. Use the result in a filter. Select your data range, open Data > Create a filter, click the filter icon on the helper column, and choose TRUE. Only matching rows remain visible. Alternatively, build a dynamic list with =FILTER(A1:A100, ISNUMBER(SEARCH("apple", A1:A100))).
  9. Apply conditional formatting. Select the text column, open Format > Conditional formatting, choose “Custom formula is”, and enter =ISNUMBER(SEARCH("apple", A1)) (adjust the starting cell to match your selection). Pick a fill colour and click Done. Matching cells are highlighted automatically.
  10. Handle errors. If SEARCH cannot find the text it returns an error, which ISNUMBER converts to FALSE, so the basic pattern is already safe. If your source cell might be empty, wrap the whole thing in IFERROR to keep the sheet tidy: =IFERROR(ISNUMBER(SEARCH(D1, A1)), FALSE).

Menu labels can differ slightly between the desktop browser version and the mobile app, and Google occasionally renames items, so if you cannot find a command, look for the closest equivalent in the same menu.

Common Mistakes

  • Using SEARCH without ISNUMBER. SEARCH returns a position number or an error, not TRUE/FALSE. Wrapping it in ISNUMBER is what turns it into a logical test.
  • Forgetting wildcards behave differently. SEARCH treats ? and * as wildcards, so searching for “a*b” will not match a literal asterisk. Use a tilde (~) to escape them, or switch to FIND, which treats them literally.
  • Mixing up relative and absolute references. When you copy a formula down, A1 should change to A2, A3 and so on, but your search-term cell (D1) should stay fixed as $D$1. Otherwise the term shifts and results go wrong.
  • Expecting FIND to ignore case. FIND is case-sensitive; if your data has inconsistent capitalisation, SEARCH is usually the safer choice.
  • Applying conditional formatting to the wrong range. The formula must reference the top-left cell of the selected range, or the highlighting will be offset by one or more rows.

Tips

  • Keep search terms in a small lookup table rather than typing them into formulas. It makes bulk edits and audits much faster.
  • Use TRIM around the source cell if your data has stray spaces: =ISNUMBER(SEARCH(D1, TRIM(A1))).
  • For whole-word matching, add spaces around the term or use REGEXMATCH with word boundaries, for example =REGEXMATCH(A1, "\bapple\b"). REGEXMATCH is case-sensitive by default; add (?i) at the start of the pattern to ignore case.
  • Name your helper column clearly (for example “Contains apple?”) so other people opening the sheet understand what the TRUE/FALSE values mean.
  • Test a formula on a few rows before filling it down hundreds of rows; a small error becomes a large mess quickly.

Troubleshooting

  • Every result is FALSE. Check the search term for leading or trailing spaces, confirm the source column is text and not numbers, and verify the cell reference points at the right row.
  • You see #VALUE! or #N/A. This usually means SEARCH received an empty or invalid argument. Wrap the formula in IFERROR and confirm the search-term cell is not blank.
  • Conditional formatting highlights nothing. Re-open the rule and check the range and the starting cell reference; the formula must be written relative to the first cell in the range.
  • The formula works in one row but not others. Look for absolute references ($) that should be relative, or vice versa, and check whether the fill handle copied the formula or just the value.
  • Results look stale. Recalculation is automatic in Google Sheets, but if a filter or formatting rule seems out of date, refresh the browser tab or re-apply the rule.

Frequently Asked Questions

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

SEARCH is case-insensitive and supports wildcards; FIND is case-sensitive and treats wildcards as literal characters. Both return the position of the match or an error if nothing is found.

How do I check if a cell contains any of several words?

Use SUMPRODUCT with an array of terms: =SUMPRODUCT(--ISNUMBER(SEARCH({"apple","pear"}, A1)))>0. It returns TRUE if at least one term appears.

Can I use “contains” in a QUERY function?

QUERY supports SQL-like matching with LIKE and the % wildcard, for example =QUERY(A1:B10, "select A where A like '%apple%'"). This is handy for building summary tables without helper columns.

Why does my contains formula return TRUE for partial words?

SEARCH matches substrings, so “app” matches “apple”. For whole-word matching, use REGEXMATCH with word boundaries or add spaces around the search term.

Does the contains formula work on numbers?

SEARCH converts numbers to text automatically, so =ISNUMBER(SEARCH("123", A1)) works if A1 holds 12345. For numeric comparisons, a simple equality or range test is usually clearer.

Can I highlight rows that contain a word?

Yes. Select the rows, open Format > Conditional formatting, choose “Custom formula is”, and enter a formula such as =ISNUMBER(SEARCH("apple", $A1)), adjusting the column reference to match your data.