To find text within a string in Excel, the most effective method is using the SEARCH or FIND functions. These formulas return the starting position of a specific character or word within a cell; if the text is not found, they return a #VALUE! error, which you can handle using the ISNUMBER function to create a simple TRUE or FALSE indicator. This allows you to identify if a specific keyword exists regardless of where it sits in the cell.
What You'll Need
- Microsoft Excel (works in all versions including Office 365, 2021, 2019, and Excel Online).
- A dataset containing strings of text (sentences, IDs, or descriptions) in one column.
- The specific keyword or character sequence you are searching for.
Step-by-Step
- Identify your target data: Ensure your text strings are in a consistent column (e.g., Column A) and your search term is either written directly into the formula or placed in a separate cell (e.g., Cell C1) for easy updates.
- Choose your function (SEARCH vs. FIND): Decide if you need a case-sensitive search. Use
SEARCHif you want to find "Apple" regardless of whether it is written as "apple", "APPLE", or "Apple". UseFINDif the capitalization must match exactly. - Enter the basic search formula: In an empty cell next to your data, type
=SEARCH("keyword", A2). Replace "keyword" with the text you are looking for and A2 with the cell containing the string. If the keyword is found, Excel will display a number representing the character position where the text begins. - Convert the result to a Boolean (TRUE/FALSE): Because a number is hard to filter and an error is messy, wrap the formula in
ISNUMBER. Enter=ISNUMBER(SEARCH("keyword", A2)). Now, if the text exists, the cell shows TRUE; if it does not, it shows FALSE. - Create a custom label using the IF function: To make the data more readable for reports, wrap the previous formula in an
IFstatement. Use=IF(ISNUMBER(SEARCH("keyword", A2)), "Found", "Not Found"). This replaces the technical TRUE/FALSE with a clear status label. - Apply the formula to the entire range: Hover your mouse over the bottom-right corner of the cell containing your formula until the cursor turns into a small black cross (the fill handle). Double-click or click and drag downward to apply the search to all rows in your dataset.
- Filter the results: Select your header row, go to the Data tab, and click Filter. Click the dropdown arrow in your search result column and check only "Found" to see every row containing your target string.
Common Mistakes
One of the most frequent errors is forgetting that the FIND function is case-sensitive. Users often wonder why their formula returns #VALUE! even though the word is clearly visible; usually, this is because the formula is looking for "Project" while the cell contains "project". Switching to SEARCH resolves this immediately.
Another common mistake is neglecting the use of ISNUMBER. When using SEARCH or FIND on their own, Excel returns a #VALUE! error for every cell that does not contain the text. If you try to perform further calculations or use these cells in a pivot table, these errors will break your results. Always wrap search functions in ISNUMBER or IFERROR to ensure a clean dataset.
Users also frequently hard-code their search terms inside the formula (e.g., =SEARCH("Red", A2)). While this works for a single search, it becomes tedious if you need to change the keyword across 50 different formulas. The professional approach is to reference a cell (e.g., =SEARCH($C$1, A2)), allowing you to change the search term in one place and have the entire sheet update instantly.
Finally, failing to account for wildcards can limit your search power. Some users try to find variations of a word by writing multiple IF statements. Instead, SEARCH supports wildcards like the asterisk (*) for any number of characters and the question mark (?) for a single character, which can simplify complex searches.
Tips
To search for multiple different keywords in a single cell, you can use an array constant within the SEARCH function. For example, =SUMPRODUCT(--ISNUMBER(SEARCH({"Red","Blue","Green"}, A2)))>0 will return TRUE if any one of those three colors is found in cell A2. This is significantly faster than writing three separate IF statements nested inside one another.
If you need to find the position of the last occurrence of a piece of text rather than the first, you cannot use SEARCH alone. You will need a combination of SUBSTITUTE, LEN, and SEARCH. By calculating the length of the original string and subtracting the length of the string with the target word removed, you can determine how many times the word appears and locate the final instance.
For those working with massive datasets, consider using the Filter feature's "Contains" logic before writing formulas. If you only need to see the data once and don't need a permanent column of TRUE/FALSE values, clicking the Filter arrow > Text Filters > Contains is the fastest way to isolate specific strings without adding any formulas to your workbook.
When searching for characters that are also used in formulas (like quotes or brackets), remember that you may need to double the quotes within the string to tell Excel you are looking for a literal quotation mark. For example, to find the word "Hello" in quotes, your formula string would look like """Hello""".
Troubleshooting
If your formula is returning #VALUE! for every single cell, first check if you are using FIND instead of SEARCH. Verify that the capitalization of your search term matches the data exactly. If the capitalization is correct and it still fails, check for leading or trailing spaces in your data cells. A cell that looks like " Apple" (with a leading space) might cause issues if you are searching for a precise match in other contexts, though SEARCH usually handles this well.
If the formula returns a number you didn't expect, remember that Excel starts counting at 1. If your search term is the very first character in the cell, the result will be 1. If the result is 15, it means the first letter of your search term is the 15th character in that string, including spaces and punctuation.
If your ISNUMBER formula is returning FALSE even though you can see the text, check the formatting of the cell. If the cell is formatted as Text instead of General, Excel might be displaying the formula itself as a string rather than executing the calculation. Change the cell format to General and press Enter in the formula bar to trigger the calculation.
When referencing a cell for your search term (e.g., =SEARCH(C1, A2)), ensure you have used absolute references (dollar signs) like $C$1 if you plan to drag the formula down. If you use a relative reference like C1, Excel will shift the search term to C2, C3, and so on as you move down the rows, leading to incorrect FALSE results because those cells are likely empty.
Frequently Asked Questions
Can I search for text and return the value from a different column?
Yes, you can combine IF and ISNUMBER(SEARCH()) to return a value from another column. For example, =IF(ISNUMBER(SEARCH("Urgent", A2)), B2, "") will return the value in B2 only if the word "Urgent" is found in A2.
How do I find text that is NOT in a string?
You can use the NOT function or simply swap the TRUE and FALSE results in your IF statement. For example, =IF(ISNUMBER(SEARCH("keyword", A2)), "Contains", "Does Not Contain") allows you to identify cells missing the target text.
Does the SEARCH function work with numbers?
Yes, SEARCH can find numbers within a string, but it treats them as text. If you are searching for the number 123 within a cell, Excel will look for the characters "1", "2", and "3" in that sequence.
How can I search for multiple keywords using an OR condition?
The most efficient way is to use SUMPRODUCT combined with an array of keywords: =SUMPRODUCT(--ISNUMBER(SEARCH({"Term1","Term2"}, A2)))>0. This returns TRUE if either Term1 or Term2 is present.
Is there a way to find text without using formulas?
Yes, you can use the Find and Replace tool (Ctrl + F) to jump to specific text, or use the Filter tool under the Data tab to show only rows that contain a specific string of text.
Why is my SEARCH formula returning a number instead of Yes/No?
The SEARCH function is designed to return the character position (an integer). To get a Yes/No answer, you must wrap it in ISNUMBER and then an IF statement to translate that number into your desired label.