Part of the free Module 5: Excel Formulas and Functions · Function 76 of 105 · Full Excel course
The Excel SEARCH function returns the position of a text string inside another text string, ignoring letter case and accepting the wildcards * and ?. If the text is not found it returns #VALUE!. SEARCH is the flexible partner of FIND: use it when you do not know how the text will be capitalised or when you want to match a pattern rather than exact characters.
Syntax
=SEARCH(find_text, within_text, [start_num])
Arguments
| Argument | Required / Optional | Meaning |
|---|---|---|
| find_text | Required | The text or pattern to look for. ? matches any single character and * matches any sequence of characters. Use ~ before ? or * to search for the literal symbol. |
| within_text | Required | The text or cell in which to search. |
| start_num | Optional | The character position at which to begin. Default is 1. The returned position is still counted from the start of within_text. |
How SEARCH works
SEARCH scans within_text from start_num and returns the position of the first match, counted from character 1. Case is ignored, so =SEARCH("excel","Microsoft Excel") returns 11. With wildcards, the match is the earliest position from which the pattern can be satisfied: =SEARCH("e*l","I love Excel") returns 5, because the pattern can start at the e in “love” and stretch to the l in “Excel”. An empty find_text returns start_num. Numbers are treated as text.
Step-by-step example: flag rows that contain a keyword
- Column A contains product descriptions with mixed capitalisation, such as
Wireless Mouse, BlackandUSB-C wireless keyboard. - In B2 enter
=SEARCH("wireless",A2). It returns 1 for the first row and 7 for the second; case does not matter. - Type a description without the word in A4 and copy the formula down. B4 shows #VALUE!.
- Change B2 to
=ISNUMBER(SEARCH("wireless",A2))and fill down. The column now shows TRUE or FALSE, which works cleanly with filters and COUNTIF.
Practical use cases
1. Categorise text by keyword
=IF(ISNUMBER(SEARCH("refund",A2)),"Refund",IF(ISNUMBER(SEARCH("invoice",A2)),"Billing","Other"))
2. Extract the text before the first digit
=LEFT(A2,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A2&"0123456789"))-1)
Appending the digits guarantees every SEARCH finds a match; MIN picks the earliest position.
3. Wildcard match on a code pattern
=ISNUMBER(SEARCH("INV-????-2026",A2))
TRUE when the cell contains INV-, any four characters, then -2026.
4. Domain from an email address, any case
=MID(A2,SEARCH("@",A2)+1,LEN(A2))
5. Count cells containing a word
=SUMPRODUCT(--ISNUMBER(SEARCH("urgent",A2:A500)))
Common mistakes and tips
- #VALUE! error: the text is not found, or start_num is 0, negative or beyond the text length. Wrap in ISNUMBER or IFERROR.
- Searching for a literal asterisk or question mark: prefix it with a tilde, for example
=SEARCH("~*",A2). - Need case sensitivity: use FIND, which distinguishes “Apple” from “apple”.
- Whole words: SEARCH(“cat”,”category”) matches. Surround both texts with spaces,
SEARCH(" cat "," "&A2&" "), to match whole words only. - Start position: the result is always relative to the start of within_text, not to start_num.
SEARCH compared with FIND
The two functions have identical syntax and both return the position of the first match. FIND is case-sensitive and treats * and ? as ordinary characters. SEARCH is case-insensitive and treats * and ? as wildcards. In practice SEARCH is the safer default for user-entered text, product descriptions and email addresses, where capitalisation is unpredictable. FIND is preferred for machine-generated codes where case carries meaning, and for text that legitimately contains * or ?, so you do not need to escape them. Performance is the same. If you later switch a formula from one to the other, no arguments need to change, which makes SEARCH and FIND easy to swap when the requirement changes.
Related functions
- FIND: the case-sensitive version without wildcards.
- MID: extracts text from the position SEARCH returns.
- SUBSTITUTE: replaces the text once you know it is present.
- ISNUMBER: converts a SEARCH result into TRUE or FALSE.
- See all lessons in the Excel Formulas course.
Frequently asked questions
What is the difference between SEARCH and FIND in Excel?
SEARCH ignores case and supports the wildcards * and ?; FIND is case-sensitive and treats those symbols literally. Their arguments and return values are otherwise identical.
How do I check if a cell contains specific text with SEARCH?
Wrap it in ISNUMBER: =ISNUMBER(SEARCH(“text”,A2)) returns TRUE when the text is present and FALSE when it is not, without showing an error.
How do I search for a literal asterisk or question mark?
Put a tilde in front of the character: =SEARCH(“~*”,A2) finds an asterisk and =SEARCH(“~?”,A2) finds a question mark.
Need a ready-made template? Browse 7,000+ Excel, Power BI and Google Sheets templates at NextGenTemplates.com.