SEARCH Function

Excel Functions › Text

All Excel versions Text Wildcards

The Excel SEARCH function returns the position of one text string inside another — like FIND, but forgiving. It ignores capitalization and understands the wildcards ? and *, which makes it the everyday choice for “does this cell mention…?” tests on messy, human-typed data: support tickets, product notes, address lines.


Quick answer: to find where "refund" appears in A2, any capitalization:
=SEARCH("refund", A2)
It matches "refund", "REFUND", and "Refund" alike, returning the position of the first hit. Not there at all? SEARCH returns #VALUE! — wrap in ISNUMBER for a clean TRUE/FALSE test.

Syntax

=SEARCH(find_text, within_text, [start_num])
ArgumentDescription
find_textRequiredThe text or wildcard pattern to locate. Case is ignored. ? matches any one character, * any run of characters; prefix with ~ to match a literal ? * or ~.
within_textRequiredThe string to look inside.
start_numOptionalPosition to start looking from (default 1). Use it to skip past an earlier occurrence.

Available in: every version of Excel. SEARCH always returns the position where the match starts, counting from 1 — even for a wildcard pattern that goes on to match many characters. When the pattern isn’t found, the result is #VALUE!.

The “contains text” test

Customers type "REFUND", "Refund", and "refund" — SEARCH catches them all. The ISNUMBER wrapper converts position-or-error into a clean yes/no:

AB
1Ticket subjectRefund?
2REFUND request - order 4417Yes
3Login problem on mobileNo
4Please refund shipping feeYes
=IF(ISNUMBER(SEARCH("refund", A2)), "Yes", "No") // any capitalization counts

Position itself is useful too, exactly as with FIND:

=SEARCH("order", A2) // returns 17 for the first ticket

Try it: SEARCH vs FIND, live

Live demo

Search inside Order #4417: REFUND requested (shoes, size 9?). Toggle case and wildcards to see where SEARCH forgives and FIND refuses.

Wildcard patterns and SEARCH combos

Wildcards turn SEARCH into a mini pattern-matcher. ? stands for exactly one character, * for any number (including zero):

=SEARCH("inv-????", A2) // matches "INV-2026", "inv-0042", any 4 characters after the hyphen
=ISNUMBER(SEARCH("*@*.com", A2)) // TRUE for anything shaped like a .com email

To hunt a literal question mark, asterisk, or tilde, escape it with ~:

=SEARCH("~?", A2) // position of the actual ? character

SEARCH feeds extractions exactly the way FIND does — handy when the delimiter’s case is unpredictable:

=LEFT(A2, SEARCH(" x", A2 & " x") - 1) // text before " x" or " X" - first part of "120 X 45"

Categorize messy text by testing several keywords (Excel 2019+ for IFS shown; nested IFs work everywhere):

=IFS(ISNUMBER(SEARCH("refund", A2)), "Billing", ISNUMBER(SEARCH("login", A2)), "Access", TRUE, "Other")

Counting or replacing instead of locating? SUBSTITUTE swaps the text once you’ve found it; COUNTIF accepts the same wildcards for counting matching cells.

Errors & common pitfalls

#VALUE! — pattern not found. SEARCH’s only error in normal use (bad start_num aside). Unlike FIND, capitalization is never the culprit — the text genuinely isn’t there. Wrap in IFERROR(…, 0) or test with ISNUMBER.

Pitfall: wildcards fire when you meant them literally. Searching customer text for "?" returns 1 on every non-empty cell, because ? matches any single character. Escape it: =SEARCH("~?", A2) — or use FIND, which takes everything literally.

Pitfall: case-insensitivity can over-match. Looking for the unit "MB"? SEARCH also hits "Mb", "mb", and the letters inside "lumber". When capitalization carries meaning, switch to FIND; to avoid mid-word hits, search for the term with surrounding spaces.

Pitfall: SEARCH reports where a * match starts, not how long it is. =SEARCH("o*d", "Order 4417") returns 1 — and tells you nothing about the match’s span. Wildcard SEARCH is best used inside ISNUMBER as a yes/no test rather than for measuring extractions.

Practice workbook

📊
Download the free SEARCH practice workbook
Every example on this page, ready to open in Excel — plus practice challenges with answers on a separate tab. No sign-up required.

Frequently asked questions

What's the difference between SEARCH and FIND?
SEARCH ignores case and supports the wildcards ? * (escape with ~); FIND matches case exactly and treats those characters literally. Identical arguments and outputs otherwise. Messy human text → SEARCH; precise codes where case matters → FIND.
How do I test if a cell contains a word, ignoring case?
=ISNUMBER(SEARCH("word", A2)) returns TRUE or FALSE. The wrapper matters: a bare SEARCH returns #VALUE! on a miss, which breaks IF logic on its own.
How do wildcards work in SEARCH?
? matches exactly one character, * matches any run of characters (even none), and ~ escapes the next character so ~? means a real question mark. So =SEARCH("inv-????", A2) finds "INV-" followed by any four characters.
Why does SEARCH return #VALUE!?
The pattern isn't anywhere in within_text, or start_num is less than 1 or beyond the string's length. Since SEARCH already forgives case, a miss means the text really is absent — handle it with IFERROR or ISNUMBER.
How do I search for a literal question mark or asterisk?
Escape with a tilde: =SEARCH("~?", A2) finds a real ?, =SEARCH("~*", A2) a real *, and ~~ a real tilde. Or simply use FIND, which never treats them as wildcards.
Can SEARCH look at a whole range of cells?
SEARCH inspects one string at a time. To test many cells, fill the formula down — or count matches across a range with COUNTIF and the same wildcards: =COUNTIF(A2:A100, "*refund*").

Master functions like this in one day

This page covers one function. Our Excel Formulas and Functions class covers the 30 that matter most — live, hands-on, taught by professionals in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related functions: FIND · LEFT · MID · RIGHT · SUBSTITUTE · TEXTBEFORE