How to Return TRUE If Cell Contains Text in Excel (8 Easy Ways)

Get FREE Advanced Excel Exercises with Solutions!

Sometimes we need to determine whether a cell contains text or not. Because that cell might be needed for other purposes where the cell format needs to be text. Here, we will discuss how you can return True if the cell contains text in Excel using 8 easy methods with detailed explanations.

Here, we directly returned TRUE in cell C5 based on whether there is a text in cell B5 using the ISTEXT function.

overview of Excel Return True If Cell Contains Text


How to Return TRUE If Cell Contains Text in Excel: 8 Easy Ways

Here in the below dataset, we have the product category of the vegetable cart. It also has some outliers also as numbers. For this dataset, we will determine which of them are text and return TRUE if they are text indeed. To avoid any compatibility issues, try to use the Excel 365 edition.

sample dataset containing the Category of the products


1. Use ISTEXT Function to Directly Return TRUE If Cell Contains Text

Here, the ISTEXT function will directly determine whether the cell has text or not. And later will return TRUE or FALSE based on it. Therefore, follow the below steps to return true if the cell contains the text.

Steps:

  • Select cell C5 and enter the following formula:

=ISTEXT(B5)

  • Press Enter after this.

Use ISTEXT Function to Return True If C5 Cell Contains Text

  • Then drag the Fill Handle to cell C13.
  • After that, 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.

using autofill returns other results


2. Return TRUE for Text Through IF Function with Match Word

Here, the IF function will be used to determine whether a cell has text values or not. And return TRUE or FALSE based on it.

Steps:

  • Select cell C5 and enter the following formula:

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

  • Press Enter after this.

IF Function returns true for specific text

  • Then drag the Fill Handle to cell C13.
  • After that, 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.

autofill returns IF function outputs for the below cells


3. Utilize ISNUMBER and SEARCH Functions to Return TRUE for Specific Text

The combination of the ISNUMBER and the SEARCH function will be used to determine whether a cell has text values or not and return TRUE and FALSE based upon it.

Steps:

  • Select cell C5 and enter the following formula:

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

  • Press Enter after this.

Utilize ISNUMBER and SEARCH Functions to return true if C5 cell contains specific text

🔍 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.

  • Then drag the Fill Handle to cell C13.
  • After that, 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.

TRUE and FALSE is returned after using fill handle


4. Apply ISNUMBER and FIND Functions to Return True by Finding Text

The combination of the ISNUMBER and the FIND function will be used to determine whether a cell has text values or not and return TRUE and FALSE based on it.

Steps:

  • Select cell C5 and enter the following formula:

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

  • Press Enter after this.

Apply ISNUMBER and FIND Functions to return true if cell contains particular text in Excel

🔍 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.

  • Then drag the Fill Handle to cell C13.
  • After that, 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.

TRUE and FALSE is returned after using autofill for ISNUMBER and FIND functions


5. Join IF, ISERRROR, and FIND Functions to Get TRUE for Text

Here we joined functions like IF, IFERROR, and FIND to determine whether a cell has text value or not and then return TRUE or FALSE based upon it. So, learn the following process to return true if the cell contains text in Excel.

Steps:

  • Select cell C5 and enter the following formula:

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

  • Press Enter after this.

Join IF, ISERRROR, and FIND Functions to Get True for Text if C5 cell contains text in Excel

🔍 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 represent 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, will return TRUE.

  • Then drag the Fill Handle to cell C13.
  • After that, 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.

autofil returns TRUE and FALSE for IF, ISERROR, and FIND functions


6. Combine IF and COUNTIF Functions to Return True by Condition

Here we joined functions like IF and COUNTIF to determine whether a cell has text value or not and then return TRUE or FALSE based upon it.

Steps:

  • Select cell C5 and enter the following formula:

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

  • Press Enter after this.

Combine IF and COUNTIF Functions in Excel to return true if C5 cell contains specific text

🔍 Formula Breakdown

➢ COUNTIF(B5,”*”&”Bars”&”*”):  This part of this function will count the character that the cell B5 is 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.

  • Then drag the Fill Handle to cell C13.
  • After that, 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.

TRUE and false is returned for IF and COUNTIF functions after using autofill


7. Apply IF and EXACT Functions by Matching Word Precisely

Here we joined functions like IF and EXACT to determine whether a cell has text value or not and then return TRUE or FALSE based upon it.

Steps:

  • Select cell C5 and enter the following formula:

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

  • Press Enter after this.

Apply IF and EXACT Functions to return true if cell contains particular text in Excel

🔍 Formula Breakdown

➢ EXACT(B5,”Bars”):  This part of this function will determine the cell value in cell B5 with 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.

  • Then drag the Fill Handle to cell C13.
  • After that, 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.

TRUE and false is returned for IF and EXACT functions after using autofill


8. Embedding VBA to Return TRUE If Cell Contains Exact Text

Using a simple VBA code will make the task of determining whether a cell contains text or not hassle-free and faster. Hence, follow the below process to return true if the cell contains the text in Excel.

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.

dataset for applying vba method

  • First, go to the Developer tab and click on Visual Basic. If you don’t have that, you have to enable the Developer tab. You can also press ‘Alt+F11’for open the Visual Basic Editor.

select visual basic from developer tab

  • Then there will be a new dialog box. In that dialog box, click on Insert > Module.
  • Next, in the Module editor window, type the following code:
Sub Contains_text()
    If InStr(Range("B5").Value, "Bars") > 0 Then
    Range("C5").Value = "True"
    End If
End Sub

type code in module box

  • Then close the Module window.
  • After that, go to the View tab > Macros.
  • Then click on View Macros.

run the macro using view macros command

  • After clicking View Macros, select the macros that you created just now. The file name here is Contains_text.
  • Then click Run.

select macro in the Macro dialog box and run it

  • After clicking Run, you will notice that cell C5 is now showing TRUE, as cell B5 has text.

output of macro code returns true


Download Practice Workbook


Conclusion

To sum it up, the issue of how we can use Format Painter multiple times in Excel is shown here in 5 separate methods. For this problem, a macro-enabled workbook is available to download where you can practice these methods. Feel free to ask any questions or feedback through the comment section.


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

What is ExcelDemy?

ExcelDemy - Learn Excel & Get Excel Solutions Center provides online Excel training , Excel consultancy services , free Excel tutorials, free support , and free Excel Templates for Excel professionals and businesses. Feel free to contact us with your Excel problems.
Rubayed Razib Suprov
Rubayed Razib Suprov

Rubayed Razib, holding a BSC degree in Naval Architecture & Engineering from Bangladesh University of Engineering and Technology, serves as a devoted member of the ExcelDemy project. He has contributed significantly by authoring numerous articles and showcasing proficiency in VBA. Razib efficiently automates Excel challenges using VBA macros and actively participates in the ExcelDemy forum, providing valuable solutions for user interface challenges. Apart from creating Excel tutorials, he is interested in Data Analysis with MS Excel,... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo