Excel Find Substring in Cell: Step-by-Step
In this article
To find a substring inside a cell in Excel, use the SEARCH or FIND functions wrapped in ISNUMBER: =ISNUMBER(SEARCH("text",A1)) returns TRUE when the text appears anywhere in the cell and FALSE when it does not. SEARCH ignores case, so it catches "apple" in "Apple Pie"; use FIND instead if the match must be case-sensitive. For a plain yes/no answer in words, wrap the test in IF, and for pulling the substring out rather than just detecting it, combine SEARCH with MID or LEFT and RIGHT. The steps below cover detection, filtering, extraction and what to do when a formula returns an error instead of an answer.
What You'll Need
- Excel on Windows, Mac, or the web version. All functions used here (SEARCH, FIND, ISNUMBER, IF, MID, LEFT, RIGHT, LEN) are standard and behave the same across those versions; labels in menus can differ slightly by version and region.
- A worksheet with the text in a column, ideally with a header row, so you can point formulas at clean ranges.
- Basic familiarity with entering a formula in a cell and copying it down a column.
- Optional: a helper column next to your data for the result, so you never overwrite the original text.
Step-by-Step
- Set up a helper column. Suppose your text is in column A starting at A2, with values like "Order 4581 - Blue Widget". Click cell B2 and give the column a header such as "Contains Widget" in B1. Working in a separate column keeps the original data intact and makes the result easy to filter and sort later.
- Enter the basic test formula. In B2 type
=ISNUMBER(SEARCH("Widget",A2))and press Enter. SEARCH looks through A2 for the word Widget and returns its position number if found, or the #VALUE! error if not. ISNUMBER turns that into TRUE or FALSE, which is far easier to read, filter and count. - Read the result. TRUE means the substring exists somewhere in the cell, regardless of position. FALSE means it does not. Note that SEARCH is not case-sensitive, so "WIDGET" and "widget" both match "Widget".
- Swap in FIND for a case-sensitive match. If you need to distinguish "Widget" from "widget", use
=ISNUMBER(FIND("Widget",A2)). FIND returns the position of the first exact-case match and errors if none exists, so ISNUMBER still converts it to TRUE or FALSE. Use FIND when case matters for codes, SKUs or names; use SEARCH for everyday text where case is noise. - Return readable words instead of TRUE/FALSE. Replace the bare test with
=IF(ISNUMBER(SEARCH("Widget",A2)),"Yes","No"). This reads clearly in a report. For a column that is scanned visually, you can go further with conditional formatting or a formula that outputs "Found" / "Not found". - Fill the formula down. Drag the fill handle in the corner of B2 down the column, or double-click it to fill to the end of the adjacent data. Relative references adjust so B3 checks A3, B4 checks A4, and so on. If you want to test one fixed phrase against every row, that is fine as is; if your search term lives in a cell, lock it with dollars, for example
SEARCH($D$1,A2). - Count how many rows contain the substring. Use
=SUMPRODUCT(--ISNUMBER(SEARCH("Widget",A2:A100)))to get a count without a helper column. SUMPRODUCT treats the TRUE/FALSE array as numbers once coerced with the double minus, so it adds them up. This is the fastest way to answer "how many orders mention Widget". - Filter the list to matching rows only. Select your header row, turn on filtering from the Data tab (the Filter button), then use the TRUE/FALSE column's dropdown and tick TRUE. Alternatively, use the dropdown's text filters and choose Contains, which filters the original text column directly without any formula. Both routes give the same visible subset.
- Extract the substring itself, not just a flag. To pull out everything from a marker onward, use
=MID(A2,SEARCH("-",A2)+1,100). SEARCH finds the hyphen's position, adding 1 starts just after it, and a generous length of 100 grabs the remainder. For text before a marker, use=LEFT(A2,SEARCH("-",A2)-1). Trim the result with TRIM if there are stray spaces. - Check that the substring is present before extracting. Any extraction formula built on SEARCH will throw #VALUE! on rows where the marker is missing. Wrap it:
=IFERROR(MID(A2,SEARCH("-",A2)+1,100),""). IFERROR returns a blank instead of an error, which keeps totals, sorting and pivot tables clean. - Handle multiple occurrences and wildcards. SEARCH supports wildcards:
?matches any single character and*matches any run of characters, soSEARCH("W?dget",A2)also matches "Widget". If you need a literal question mark or asterisk, put a tilde in front of it, as in~*. To locate a second or third occurrence, feed SEARCH a starting position, for exampleSEARCH("a",A2,SEARCH("a",A2)+1). - Verify a sample before trusting the column. Sort or filter to FALSE and spot-check a handful of rows by eye. This catches the two classic traps: trailing spaces that break exact matches, and data that looks like a match but differs by a hyphen or a hidden character.
Common Mistakes
- Using a bare SEARCH as the whole formula. SEARCH returns a number or an error, not TRUE/FALSE. Without ISNUMBER, a row where the text is missing shows #VALUE!, and an IF built on it misfires or errors out.
- Forgetting SEARCH is case-insensitive. If you need to tell "Code" from "code", SEARCH will not do it. Switch to FIND.
- Mixing up the arguments. The order is
SEARCH(find_text, within_text): the small string first, the cell to scan second. Reversing them returns #VALUE! on almost every row. - Hard-coding a search term in dozens of formulas. When the term changes, every formula needs editing. Put the term in one cell and reference it with absolute dollars.
- Comparing against a range instead of one cell.
SEARCH("Widget",A2:A100)works inside SUMPRODUCT but returns an error if entered in a single cell on older versions. Keep single-cell tests pointed at single cells. - Extraction without IFERROR. Every row lacking the marker produces an error that spreads into downstream sums and charts.
- Pasted data with leading or trailing spaces. These break exact-case matching. Run TRIM on the text first, or search a cleaned copy.
Tips
- Use ISNUMBER rather than checking for zero: SEARCH never returns 0, but ISNUMBER is the documented, reliable test and reads more clearly to anyone else opening the file.
- Keep the search term in its own cell with a clear label. One edit updates every formula, and you can reuse the sheet as a quick lookup tool.
- Convert the helper column to values (copy, then Paste Special > Values) before you sort, delete columns or email the workbook, so the results stop recalculating against data that is no longer there.
- For an in-cell highlight instead of a separate column, use Conditional Formatting with a formula rule such as
=ISNUMBER(SEARCH("Widget",A2))applied to the whole text range. - When matching whole words rather than fragments, surround the term with spaces in the search string, or accept that "Widgets" and "Widgetry" will also match "Widget".
- Remember that SEARCH works on text. Numbers stored as numbers behave differently, so convert them to text with TEXT or an apostrophe-prefixed entry if you need to scan digits.
Troubleshooting
If the formula shows #VALUE!, the substring was not found. That is expected behaviour for SEARCH and FIND, not a broken sheet, so wrap the test in ISNUMBER or the whole step in IFERROR.
If every row returns FALSE when you can see the text, check for case (if using FIND), stray spaces, non-breaking spaces pasted from web pages, or hidden characters. TRIM and CLEAN applied to a copy of the column will usually expose the difference. It also helps to test with a very short search term such as a single letter to confirm the formula is pointed at the right column.
If the formula will not fill correctly, check for mixed absolute and relative references. A reference like $D$1 stays fixed while A2 moves down; a reference without dollars does both, which shifts your search term row by row.
If results look stale after editing data, press F9 to recalculate, or on Windows check that calculation is set to Automatic under Formulas > Calculation Options. Manual calculation is a common reason a correct formula appears not to update.
Frequently Asked Questions
What is the difference between SEARCH and FIND?
SEARCH ignores case and supports wildcards such as * and ?. FIND is case-sensitive and treats wildcard characters literally. Both return the position of the match and error out when the text is absent.
How do I check if a cell contains any of several words?
Nest the tests with OR inside IF, for example =IF(OR(ISNUMBER(SEARCH("a",A2)),ISNUMBER(SEARCH("b",A2))),"Yes","No"). This works well for a handful of terms; many terms are easier to handle with a lookup list and SUMPRODUCT.
Can I find a substring starting from a specific position?
Yes. SEARCH and FIND accept an optional third argument that sets the starting character, so SEARCH("a",A2,5) begins scanning at the fifth character and ignores earlier matches.
Does this work in Excel for the web and on Mac?
Yes. These functions are standard and identical across Excel on Windows, Mac and the web version. Only menu wording and button placement differ slightly by version and region.
Why does my count formula give a decimal or zero?
A count of zero is correct when no rows match. A decimal usually means the double-minus coercion is missing or the formula was entered as a normal array without SUMPRODUCT. Keep the -- in front of ISNUMBER.
Can I use this to split text into separate columns?
Yes. LEFT, RIGHT and MID combined with SEARCH handle delimiter-based splitting, and Text to Columns on the Data tab does the same job without formulas for one-off work.