What to do when if cell contains specific text
Tutor 5 (50 Reviews)
Excel Tutor
Still stuck with a Excel question
Ask this expertAnswer
To handle a cell that contains specific text in Excel, use the IF, SEARCH, or COUNTIF functions to detect the text and return a result. Excel checks each cell and returns a value based on the match.
How to check whether a cell contains specific text
A cell contains specific text when the SEARCH function finds a match. The SEARCH function returns a number greater than zero when the text exists.
Windows and Mac Differences
Excel uses the same formulas on Windows and Mac. Keyboard shortcuts differ, but formula behavior stays identical across both systems.
Formula for detecting specific text
Use this structure:
=IF(ISNUMBER(SEARCH("text", A1)), "Yes", "No")
Explanation
-
SEARCH("text", A1)finds the starting position of the text. -
ISNUMBER(...)confirms the presence of the text. -
IF(...)returns your chosen output.
How to return a custom value when text is found
A user returns any custom value, such as a category or label.
Example (LaTeX not required here)
=IF(ISNUMBER(SEARCH("apple", A1)), "Fruit Found", "Not Found")
How to apply an action when a cell contains text
Use a structured workflow:
-
Identify the specific text to check.
-
Select the output or action Excel should perform.
-
Insert the
IFandSEARCHformula. -
Drag the formula down to extend it across multiple rows.
-
Validate cell outputs to confirm matches.
How to highlight cells containing specific text
Conditional Formatting applies color-coding to matched cells.
-
Select the range.
-
Open Home > Conditional Formatting > New Rule.
-
Choose Format only cells that contain.
-
Set Specific Text and type the text.
-
Apply formatting and confirm.
How to count how many cells contain specific text
Use COUNTIF to return the total number of matching cells.
=COUNTIF(A1:A100, "*text*")
The asterisks match text anywhere in the cell.
How to extract part of a cell when specific text exists
A custom extraction uses IF and MID.
-
Detect the text with
SEARCH. -
Return a substring with
MID. -
Use
LENto set the extraction length when needed.=IF(ISNUMBER(SEARCH("code", A1)), MID(A1, 1, 10), "")
How to run multiple text checks at once
Multiple conditions run through OR.
=IF(OR(ISNUMBER(SEARCH("apple", A1)), ISNUMBER(SEARCH("pear", A1))), "Match", "No Match")
How to avoid errors when the text does not exist
SEARCH returns an error when no match exists. IFERROR prevents the error.
=IFERROR(SEARCH("text", A1), "")
How to create a more flexible check
Case-insensitive checks rely on SEARCH. Case-sensitive checks use FIND.
=IF(ISNUMBER(FIND("Text", A1)), "Exact Case Match", "No Match")
Get Online Tutoring or Questions answered by Experts.
You can post a question for a tutor or set up a tutoring session
Answers · 1
Why is today function not working
Answers · 1
How to extract date from datetime in excel
Answers · 1
Why is the date value not working
Answers · 1
How to create a date formula
Answers · 1