FormulaCraft

How to return a value if a cell contains text in Excel and Google Sheets

Topic:IF, IFS & nested conditions
Excel & Google Sheets
=IF(ISNUMBER(SEARCH("apple",A2)),"Contains apple","Does not contain")

Verified example

Computed by a real spreadsheet engine on the sample data below.

ProductFlag
apple juice
orange soda
apple cider
mango drink

=IF(ISNUMBER(SEARCH("apple",A2)),"Contains apple","Does not contain")Contains apple

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

Step by step

  1. 1Use SEARCH to find the text (SEARCH is case-insensitive): SEARCH("apple",A2) returns the position number if found, or an error if not.
  2. 2Wrap SEARCH in ISNUMBER to convert the result to TRUE/FALSE: ISNUMBER(SEARCH("apple",A2)).
  3. 3Wrap in IF: =IF(ISNUMBER(SEARCH("apple",A2)),"Contains apple","Does not contain") to return your desired text for each case.

Tips

Working on a sheet you inherited? Run the Auditor on the whole file first — it flags every #REF!, #N/A, broken column pattern, and inconsistent formula in seconds, free, no signup.

Frequently asked

Why use ISNUMBER instead of just SEARCH?

SEARCH returns an error (#VALUE!) when the text is not found, not FALSE. ISNUMBER converts both a number (found) and an error (not found) into TRUE/FALSE, which IF can use.

Can I check if a cell contains any text at all (not a specific word)?

Yes: =IF(ISTEXT(A2),"Is text","Not text") checks whether the cell contains any text value.

More on IF, IFS & nested conditions

See all →

Formulas used

Related tasks

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: