How to Check, Highlight & Return Value If Cell Contains Text?

Here’s an overview of a simple IF check that returns a predetermined pair of values.

1- an overview image if a cell contains text in Excel


Download the Practice Workbook


Excel Condition If Cell Contains Text: 13 Useful Applications


Method 1 – Use the IF Function to Check If the Cell Contains Text and Return a Value in Excel

You can use the IF function to check if the cell contains text and then return a value. If the condition is met, it returns a TRUE value, otherwise it returns a FALSE value.

1.5- syntax of IF function

  • Insert the following formula in cell D5 and press Enter.
  • Use the AutoFill tool to apply the same formula in the cells D5:D13.
=IF(B5="Bars","Available","Not Available")
  • As a result, Available or Not Available will appear in the status column.

2- using IF function to check if cell contains text then return value in Excel


Method 2 – Use IF and ISTEXT Functions to Check If the Cell Contains Text and Return a Value

The ISTEXT function checks whether a value is text, and returns TRUE or FALSE.

2.5- syntax of ISTEXT function

  • Insert the following formula in cell D5 and press Enter.
  • Use the AutoFill tool to apply the same formula in the cells D5:D13.
=IF(ISTEXT(B5),B5,"")
  • This formula will only return values for cells that have text values.

3- utilizing IF & ISTEXT functions to check if cell contains text


Method 3 – Apply ISNUMBER and SEARCH Functions to Find If a Cell Contains Specific Text

The ISNUMBER function checks whether a value is a number and returns TRUE or FALSE.

3.1- syntax of ISNUMBER function

The SEARCH function returns the number of characters at which a specific character or text string is first found, reading left to right (not case-sensitive).

3.2- syntax of SEARCH function

  • Insert the following formula in cell D5 and press Enter.
=ISNUMBER(SEARCH("Bars",B5:B5))
  • Use the AutoFill tool to apply the same formula in the cells D5:D13.
  • True or False appear in the status column.

4- applying ISNUMBER & SEARCH functions to find if cell contains text


Method 4 – Return a Given Value If a Cell Contains Specific Text

  • Insert the following formula in cell D5 and press Enter.
=IF(B5="Bars","Available","")
  • Use the AutoFill tool to apply the same formula in the cells D5:D13.
  • We will get our desired output.

5- checking if cell contains specific text then return a value


Method 5 – Return a Value If a Cell Contains Case-Sensitive Specific Text

The EXACT function checks whether two text strings are exactly the same and returns TRUE or FALSE. It is case-sensitive.

5.5- syntax of EXACT function

  • Insert the following formula in cell D5 and press Enter.
=IF(EXACT(B5,"Bars"),"Available","")
  • Use the AutoFill tool to apply the same formula in the cells D5:D13.
  • We will get the value Available in cells with the exact text “Bars”.

6- return a value if cell contains specific text in case-sensitive scenario


Method 6 – Add 1 If a Cell Contains Specific Text in Excel

We’ve added two new columns titled Amount and Updated Amount. We’ll add 1 to the Amount and show that in Updated Amount if the cell passes the check.

  • Insert the following formula in cell E5 and press Enter.
=IF(B5="Crackers",D5+1, D5 )
  • Use the AutoFill tool to apply the same formula in the cells E5:E13.

7- adding 1 if cell contains specific text in Excel


Method 7 – Check If the Cell Contains Partial Text

We’ll look for partial matches with the text “Cra”.

  • Insert the following formula in cell D5 and press Enter.
=IF(COUNTIF(B5,"Cra*"),"Yes","No")
  • Use the AutoFill tool to apply the same formula in the cells D5:D13.
  • As a result, we will get the value Yes in cells with the partial text “Cra”.

8- checking if cell contains partial text in Excel


Method 8 – Return a Value in Another Cell Using INDEX and MATCH Functions If the Cell Contains Text

We have slightly altered the dataset.

  • Insert the following formula in cell C15 and press Enter.
=INDEX(C5:C13,MATCH("Bars",B5:B13,0))
  • We will get our product name “Carrot” that correlates to the row that contains “Bars” in column B.

9- if cell contains text then return value in another cell using INDEX and MATCH functions


Method 9 – Return TRUE If Cell Contains Text in Excel Using a Combination of IF, ISERROR, and FIND Functions

  • Insert the following formula in cell D5 and press Enter.
=IF(ISERROR(FIND("Bars",B5,1)),"False","TRUE")
  • Use the AutoFill tool to apply the same formula in the cells D5:D13.
  • The range D5:D13 returned TRUE or FALSE based on whether there is text in each cell in the range B5:B13.

10- returns TRUE if cell contains text in Excel

Read More: IF-THEN Statements with Text


Method 10 – Highlight a Cell If It Contains Specific Text in Excel

We want to highlight a cell that contains “Bars”.

  • Select the entire dataset.
  • Go to the Home tab.
  • Select Conditional Formatting and choose New Rule.

11- selecting new rule from conditional formatting feature

  • Select Use a formula to determine which cells to format under the Select a Rule Type section from the New Formatting Rule window.
  • Insert the following formula in the Format values where this formula is true section.
=$B5=$C$15
  • Click on Format to choose a fill color and click OK.
  • Click OK to apply formatting.

12- editing new formatting rule window

  • We have highlighted the cells that contain specific text “Bars”.

13- final output image of highlighting cell if contains specific text

Read More: If Cell Contains Text Then Copy to Another Sheet


Method 11 – Copy to Another Sheet Using the FILTER Function If a Cell Contains Text

We want to copy the text string “Crackers” and its corresponding product from the FILTER Sheet to the new FILTER(2) Worksheet.

  • Use the following formula in cell B5 of the sheet FILTER(2) and press Enter.
=FILTER(FILTER!B5:C13,FILTER!B5:B13="Crackers","")
  • We will get the product names for the category “Crackers”.

14- use of FILTER function

Read More: If Cell Contains Text Then Return Value in Another Cell Using Formula


Method 12 – Return a Value If a Cell Contains One of Many Text Strings

We want to search cells that contain at least one text string between “Bars” or “Veg”.

  • Insert the following formula in cell D5 and press Enter.
=IF(OR(ISNUMBER(SEARCH("Bars",B5)),ISNUMBER(SEARCH("Veg",B5))),"Available","")
  • Use the AutoFill tool to apply the same formula in the cells D5:D13.

15- returning a value if cell contains one of many text strings

We used ISNUMBER and SEARCH functions to match the text “Bars’’ or “Veg”. Then the OR function is used to declare an alternative match. The IF function shows the value if the condition meets. Otherwise, the cells remain blank.

Read More: If Cell Contains Specific Text Then Add 1


Method 13 – Return a Value If a Cell Contains Several of Many Text Strings

We want to search cells that must contain both text strings of “Bars” and “Chlt”.

  • Insert the following formula in cell D5 and press Enter.
=IF(AND(ISNUMBER(SEARCH("Bars",B5)),ISNUMBER(SEARCH("Chlt",B5))),"Available ","")
  • Use the AutoFill tool to apply the same formula in the cells D5:D13.

16- returning value if cell contains both text strings

Read More: Check If Cell Contains Text Then Return Value


How to Return a Value If a Cell Does Not Contain Specific Text?

  • Insert the following formula in cell D5 and press Enter.
=IF(B5="Bars","","No")
  • Use the AutoFill tool to apply the same formula in the cells D5:D13.

17- Returning a value when cell is missing specific text

Read More: Return TRUE If Cell Contains Text


If a Cell Contains Text in Excel: Knowledge Hub


<< Go Back to If Cell Contains | Formula List | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Nujat Tasnim
Nujat Tasnim

Nujat Tasnim, BSc in Computer Science and Engineering from American International University-Bangladesh, has a year-long tenure with ExcelDemy. Initially a Content Developer at SOFTEKO, she transitioned to the Software Team as Junior Software Quality Assurance Engineer. Currently serving as a Junior SQA Engineer at SOFTEKO, she excels in SDLC, STLC, and requirement analysis and possesses profound insights into OOP-related software development processes. Nujat is also proficient in design software like Photoshop and Illustrator, contributing diverse skills to her... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo