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 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 the 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 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.
Fo an 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 text “Best”. So apply the FIND function.
In the Find Text argument mention the text that we need to find.
In 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 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, IF condition will return the result accordingly.
We can also use IFERROR function 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 to excel 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 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 function. This function works without any error.
In the range, the argument selects the cell reference.
In the criteria column we need to use excel wildcard characters 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 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.
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 in excel 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 downloadable excel template. You may learn more about excel from the following articles –