Table Of Contents
How To Search For Text In Excel?
Search for Text in Excel helps us find cell values with Text or strings. We can replace the text with the desired text, strings, or characters. The usual method to search for a specific text in the worksheet is the āFind and Replaceā method.
For example, we can perform the Excel Search for text using some of the inbuilt functions in Excel, such as COUNTIF(), FIND(), SEARCH(), etc., as shown in the below image.
Here, we will take you through the formulas to search for the particular text in the cell value and arrive at the result.
Key Takeaways
- Search for Text in Excel helps users searchfor a specific word or a text in a sentence or a cell value with strings, and also replace it with another text if necessary.
- We can identify the text strings using some of the methods, namely,
- āFind & Replaceā Ć first, we find the required word, and then replace it with a new text.
- Excel formulas Ć We can use some inbuilt Excel formulas such as FIND() and SEARCH() to find text, ISNUMBER(), and ISTEXT() to identify the cell values as text and return logical Boolean values.
- We can create a rule using the Conditional Formatting method and highlight the required text.
Which Formula Can Tell Us A Cell Contains Specific Text?
A few formulas that help us identify text cells are, āFINDā function, ISNUMBER function, IF Condition, ISERROR function, etc. We will take you through the formulas to search for the particular text in the cell value and arrive at the result.
#FIND function
It can return the position of the supplied text values in the string. So, if the FIND method returns any number, then we can consider the cell as it has the text or else not.
For example, look at the below data.
Here, we have three sentences in three different rows. Now in each cell, we need to search for the text āBestā. So, apply the FIND function.
The āfind_textā argument mentions the text we need to find.
For the āwithin_textā, select the full sentence, i.e., cell reference.
The last parameter is not required. Now, close the bracket, press the āEnterā key, and drag the formula from cell B1 to B3 using the fill handle. The output is shown below.
So, cells A1 and A3 have the word ābestā. We can see the #VALUE! error in cell B2, which shows that cell A2 does not have the text value ābestā.Instead of numbers, we can also enter the result in our own words. For this, we need to use the IF condition, as shown below in the formula bar.
- So, in the IF condition, we have supplied the result as āText Foundā if the value ābestā is found. Otherwise, we have provided the result as āNot Foundā.
- But, here we have a problem, even though we have supplied the result as āNot Foundā, if the text is still not found, we are getting the error value as #VALUE!.
To fix the error we must enclose the ISNUMBER function, as shown below.
The ISNUMBER function evaluates whether the FIND function returns the number or not. If the FIND function returns the number, it will supply TRUE to the IF condition or else FALSE condition. Based on the result provided by the ISNUMBER function, the IF condition will return the result accordingly.
We can also use the IFERROR function in excel to deal with error values instead of ISNUMBER. For example, the below formula will also return āNot Foundā if the FIND function returns the error value.
Alternatives To the FIND Function
We considered the Find & Replace option, or the FIND function, to Search for Text in Excel. Now, we will see other alternative methods or functions available, such as,
- Excel Search Function.
- Excel COUNTIF Function.
Alternative #1 ā Excel Search Function
The SEARCH function in excel helps us to search the particular text in the string.
The syntax of the SEARCH function is the same as the FIND function.
Supply the āfind_textā as āBestā.
The āwithin_textā is our cell reference.
Even the SEARCH function returns an error value as #VALUE! If the finding text ābestā is not found. As seen above, we must enclose the formula with ISNUMBER or IFERROR functions.
Alternative #2 - Excel Countif Function
Another way to search for a particular text is using the COUNTIF function. This function works without any errors.
In the range, the argument selects the cell reference.
In the criteria column, we need to use a wildcard in excel because we are just finding the part of the string value, so enclose the word ābestā with an asterisk (*) wildcard.
This formula will return the word ābestā count in the selected cell value. Since we have only one ābestā value, we will get only 1 as the count.
We can apply only the IF condition to get the result without error, as shown below.
Highlight The Cell Which Has A Particular Text Value
As another alternative method, instead of using the Excel functions, we can use the āConditional Formattingā option to highlight the cell with a particular word.
For example, to highlight the cell with the word ābest,ā we need to use conditional formatting in excel.
First, select the data cells and click āConditional Formattingā > āNew Ruleā.
Under āNew Ruleā, select the āFormat only cells that containā option.
From the first dropdown, select āSpecific Textā.
The formula section enters the text we search for in double quotes with the equal sign. =ābestā.
Then, click on āFORMATā, and choose the formatting style.
Click āOKā. It will highlight all the cells which have the word ābestā.
Using various techniques, we can search the particular text in Excel.
Important Things To Note
- We can Search for Text using various methods using formulas or āConditional Formattingā.
- We can use the shortcut keys, Ctrl + F, to find the text we are looking for but cannot go beyond that. So, for example, if the cell contains certain words, we may want the result in the next cell as āTRUEā or āFALSEā. So, Ctrl + F stops there.