Sometimes we need to determine whether a cell contains text or not. You’ll see this in the following example, where we use the **ISTEXT** function to return **TRUE** in cell **C5 **based on whether cell **B5** contains text:

In the below dataset, we have the product category of the vegetable cart. It also has some outliers set as numbers. For this dataset, we will determine which of them are text and return **TRUE** for any that are.

### Method 1 – Use the ISTEXT Function to Directly Return TRUE If Cell Contains Text

**Steps:**

- Select cell
**C5**and enter the following formula:

`=ISTEXT(B5)`

- Press
**Enter**.

- Drag the
**Fill Handle**to cell**C13**. - You will notice that the range of cell
**C5:C13**returned**TRUE**or**FALSE**based on whether there is text in each cell in the range of cell**B5:B13.**

### Method 2 – Return TRUE for Text Through IF Function with Match Word

**Steps:**

- Select cell
**C5**and enter the following formula:

`=IF(B4="Bars","True","False")`

- Press
**Enter**.

- Drag the
**Fill Handle**to cell**C13**. - You will notice that the range of cell
**C5:C13**returned**TRUE**or**FALSE**based on whether there is text in each cell in the range of cell**B5:B13.**

### Method 3 – Utilize ISNUMBER and SEARCH Functions to Return TRUE for Specific Text

**Steps:**

- Select cell
**C5**and enter the following formula:

`=ISNUMBER(SEARCH(B5,"Bars"))`

- Press
**Enter.**

** Formula Breakdown**

**➢ SEARCH(B5,”Bars”): **This part of the function will determine whether the text “Bars” is in cell **B5** and return its position.

**➢ =ISNUMBER(SEARCH(B5,”Bars”)): **This part of the function will determine whether the return from the previous function is numerical or not. If it is numerical, then it will return **TRUE**, otherwise **FALSE**.

- Drag the
**Fill Handle**to cell**C13**. - You will notice that the range of cell
**C5:C13**returned**TRUE**or**FALSE**based on whether there is text in each cell in the range of cell**B5:B13.**

### Method 4 – Apply ISNUMBER and FIND Functions to Return True by Finding Text

**Steps:**

- Select cell
**C5**and enter the following formula:

`=ISNUMBER(FIND(B5,"Bars"))`

- Press
**Enter**.

** Formula Breakdown**

**➢ FIND(B5,”Bars”): **This part of the function will determine whether the text “Bars” is in cell **B5** and return its position.

**➢ ISNUMBER(FIND(B5,”Bars”)): **This part of the function will determine whether the return from the previous function is numerical or not. If it jis numerical, then it will return **TRUE**, otherwise **FALSE**.

- Drag the
**Fill Handle**to cell**C13**. - You will notice that the range of cell
**C5:C13**returned**TRUE**or**FALSE**based on whether there is text in each cell in the range of cell**B5:B13.**

### Method 5 – Join IF, ISERRROR, and FIND Functions to Get TRUE for Text

**Steps:**

- Select cell
**C5**and enter the following formula:

`=IF(ISERROR(FIND("Bars",B5,1)),"False","TRUE")`

- Press
**Enter.**

** Formula Breakdown**

**➢ FIND(“Bars”,B5,1): **This part of the function will determine whether the text “Bars” is in cell **B5** and return its position of it. ** 1 **represents as the starting position.

**➢ ISERROR(FIND(“Bars”,B5,1)): **This will determine whether the outcome from the previous function has an error or not

**➢ IF(ISERROR(FIND(“Bars”,B5,1)),”False”,”TRUE”): **This part of the function will determine whether the return from the previous function has any error or not. If it is an error, then it will return **FALSE**. Otherwise, it will return **TRUE.**

- Drag the
**Fill Handle**to cell**C13**. - You will notice that the range of cell
**C5:C13**returned**TRUE**or**FALSE**based on whether there is text in each cell in the range of cell**B5:B13.**

### Method 6 – Combine IF and COUNTIF Functions to Return True by Condition

**Steps:**

- Select cell
**C5**and enter the following formula:

`=IF(COUNTIF(B5,"*"&"Bars"&"*"),"True","False")`

- Press
**Enter.**

** Formula Breakdown**

**➢ COUNTIF(B5,”*”&”Bars”&”*”): **This part of this function will count the characters in the **B5 **cell to see if they’re equal to **Bars.**

**➢ IF(COUNTIF(B5,”*”&”Bars”&”*”),”True”,”False”) **This part of the function will determine whether the return from the previous function has any number or not. If it is a number, then it will return **TRUE** **FALSE**, otherwise, will return **FALSE.**

- Drag the
**Fill Handle**to cell**C13**. - You will notice that the range of cell
**C5:C13**returned**TRUE**or**FALSE**based on whether there is text in each cell in the range of cell**B5:B13.**

### Method 7 – Apply IF and EXACT Functions by Matching Word Precisely

**Steps:**

- Select cell
**C5**and enter the following formula:

`=IF(EXACT(B5,"Bars"), "True", "False")`

- Press
**Enter**.

** Formula Breakdown**

**➢ EXACT(B5,”Bars”): **This part of this function will determine the cell value in cell B5 to see if it is **Bars **or not. If they are the same, then it will return **TRUE**, otherwise **FALSE**.

**➢ IF(EXACT(B5,”Bars”), “True”, “False”): **This part will return **TRUE **if the return from the previous function is **TRUE, **otherwise it will return **FALSE.**

- Drag the
**Fill Handle**to cell**C13**. - You will notice that the range of cell
**C5:C13**returned**TRUE**or**FALSE**based on whether there is text in each cell in the range of cell**B5:B13.**

### Method 8 – Embed VBA to Return TRUE If Cell Contains Exact Text

**Steps:**

- We have the text value in cell
**B5**, we need to determine whether this cell actually contains text or not and then return**Yes**or**No**based on the inspection.

- Go to the
**Developer**tab and click on**Visual Basic**. You can also press ‘**Alt+F11’**for open the**Visual Basic Editor**.

- In the new dialog box, click on
**Insert**>**Module**. - Type the following code in the
**Module**editor window:

```
Sub Contains_text()
If InStr(Range("B5").Value, "Bars") > 0 Then
Range("C5").Value = "True"
End If
End Sub
```

- Close the
**Module**window. - Go to the
**View**tab >**Macros**. - Click on
**View Macros.**

- After clicking
**View Macros,**select the macros that you created. The file name here is**Contains_text**. - Click
**Run**.

- Cell
**C5**should now show**TRUE**, as cell**B5**has**text**.

**Download Practice Workbook**

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