How to Search For Text in Excel?
When we work with excel, we see so many situations that are peculiar in nature, and one of those situations is searching for the particular text in the cell. The first thing that comes to mind when we say we want to search for a particular text in the worksheet is the “Find & Replace” method in excel, and that is the most popular one too. But Ctrl + F can find you the text you are looking for but cannot go beyond that. Let’s say if the cell contains certain words, you may want the result in the next cell as “TRUE” or else FALSE. So Ctrl + F stops there.
Here we will take you through the formulas which can search for the particular text in the cell value and arrive at the result.
Which Formula Can Tell Us A Cell Contains Specific Text?
This is the question I have seen many times in excel forums. The very first formula that came to my mind was to “FIND” function.
Find function 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.
- In the above data, 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.
- In the Find Text argument, mention the text that we need to find.
- Within Text, select the full sentence, i.e., cell reference.
- The last parameter is not required to close the bracket and hit the enter key.
So, in two sentences, we have the word “best”. We can see the error value of #VALUE! in the cell B2 that shows that the cell A2 doesn’t have the text value “best”.
- Instead of numbers, we can enter the result in our own words as well. For this, we need to use the IF condition.
So, in the IF condition, I have supplied the result as “Text Found” if the value “best” found, or else I have supplied the result to show as “Not Found.”
But here we have a problem, even though I have supplied the result as “Not Found,” if the text was not found still we are getting the error value as #VALUE!.
So, nobody wants to have an error value in their excel sheet. To overcome this error value, we need to enclose the formula with the ISNUMERIC function.
ISNUMERIC function evaluates whether the FIND function returns the number or not. If the FIND function returns the number, then it will supply TRUE to IF condition or else FALSE condition. Based on the result supplied by the ISNUMERIC function, the IF condition will return the result accordingly.
We can also use the IFERROR function in excelIFERROR Function In ExcelThe IFERROR function in Excel checks a formula (or a cell) for errors and returns a specified value in place of the error. to deal with error values instead of ISNUMERIC. The below formula will also return “not Found” if the error value returned by the FIND function.
Alternatives to FIND Function
Alternative #1 – Excel Search Function
Instead of the FIND function, we can also use the SEARCH function in excelSEARCH Function In ExcelSearch function gives the position of a substring in a given string when we give a parameter of the position to search from. As a result, this formula requires three arguments. The first is the substring, the second is the string itself, and the last is the position to start the search. 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.”
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 we have seen above, we need to enclose the formula with either ISNUMERIC or IFERROR function.
Alternative #2 – Excel Countif Function
Another way of searching for a particular text is by using the COUNTIF functionUsing The COUNTIF FunctionThe COUNTIF function in Excel counts the number of cells within a range based on pre-defined criteria. It is used to count cells that include dates, numbers, or text. For example, COUNTIF(A1:A10,”Trump”) will count the number of cells within the range A1:A10 that contain the text “Trump” . This function works without any error.
In the range, the argument selects the cell reference.
In the criteria column, we need to use a wildcard in excelWildcard In ExcelIn Excel, wildcards are the three special characters asterisk, question mark, and tilde. Asterisk denotes multiple characters, a question mark denotes a single character, and a tilde denotes the identification of a wild card character. 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 count of the word “best” in the selected cell value. Since we have only one “best” value, we will get only 1 as the count.
Now we can apply only the IF condition to get the result without any error.
Highlight the Cell which has Particular Text Value
If you are not a fan of formulas, then you can highlight the cell that has a particular word. To highlight the cell which has the word “best,” we need to use conditional formatting in excelConditional Formatting In ExcelConditional formatting is a technique in Excel that allows us to format cells in a worksheet based on certain conditions. It can be found in the styles section of the Home tab..
For this first, select the data cells and click on Conditional Formatting > New Rule.
Unser new Rule select “Format Only Cells that contain.”
From the first drop-down, select “Specific Text.”
In the formula, section enters the text that we are searching for in double-quotes with the equal sign. =”best.”
Then click on FORMAT and choose the formatting style.
Click on OK. It will highlight all the cells which have the word “best.”
Like this using various techniques, we can search the particular text in excel.
This has been a guide to Search For Text in Excel. Here we discuss the top three methods that can search the cell value for a specific text and arrive at the result along with practical examples and a downloadable excel template. You may learn more about excel from the following articles –