Knowledge base / Excel
SEARCH in Excel: positions, patterns and missing matches
I explain character positions, wildcard patterns and a contains-text flag, including why a substring match does not validate a word or domain.

When I need to locate a fragment inside a description, I use SEARCH. The function returns a position, so it can support both a matching-record flag and later text extraction. First I decide whether the requirement concerns a literal string, a pattern, or a whole word. Those are different requests.
Syntax and position counting
SEARCH is called SZUKAJ.TEKST in Polish Excel. Microsoft’s documentation lists Microsoft 365 and Excel 2024, 2021, 2019, and 2016. The English examples use commas and the Polish examples use semicolons; your actual separator depends on regional settings.
=SEARCH(find_text,within_text,[start_num])
The first argument describes what to find and the second where to find it. The optional third argument specifies a starting position, defaulting to 1. Do not enter the square brackets in a working formula. Returned positions count from the beginning of the complete string, even when searching starts later.
The starting position is included. If the requested character is there, SEARCH can return that position. This is why =SEARCH("e","Excel Spreadsheet",4) gives 4 rather than a later position in the next word.
Small examples with correct positions
All strings below are synthetic. Spaces and punctuation occupy positions just as letters do.
| Formula | Result |
|---|---|
=SEARCH("potężne","Excel to potężne narzędzie") |
10 |
=SEARCH(",","To jest test, sprawdzenie funkcji.") |
13 |
=SEARCH("e","Excel Spreadsheet",4) |
4 |
=SEARCH("e","Excel to Excel",7) |
10 |
=SEARCH("Ex?el","I use Excel daily") |
7 |
In the first string, Excel occupies positions 1 through 5, followed by a space at 6, the word to at 7 and 8, and another space at 9. The requested fragment therefore starts at 10. Spaces are easy to overlook when counting by hand. In the last example, Excel begins at position 7, and the question mark stands for one pattern character.
Letter case and wildcards
SEARCH ignores letter case. Searching for excel can therefore find Excel. When case matters, Microsoft identifies FIND as the relevant alternative. The third SEARCH argument does not change case behaviour; it sets where searching begins.
SEARCH supports ? for one character and * for a sequence of characters. To find a literal asterisk or question mark, put a tilde before it. =SEARCH("~*","AB*CD") returns 3, as does =SEARCH("~?","AB?CD").
This matters when a pattern comes from another cell. Is its asterisk intended as an operator or as part of a product code? The formula alone cannot establish that intention. Literal searching requires deliberate treatment of special characters and an agreed input format.

Check whether a cell contains a fragment
SEARCH alone returns a position or an error. For a logical helper-column flag, I combine it with ISNUMBER:
=ISNUMBER(SEARCH("excel",A2))
With Kurs Excel in A2, the result is TRUE because the position is numeric. With Kurs SQL, the result is FALSE. The flag can then support filtering of a prepared table. Microsoft describes this combination.
ISERROR can check for any error value. For this particular task, checking whether the result is numeric gives a short expression without manually creating two text labels.
The flag has a limitation: FALSE can represent an input error rather than a valid description without the phrase. If A2 already contains an error, this construction does not preserve its separate cause. For an import requiring quality checks, distinguish invalid input from valid descriptions without matches before simplifying the result.
A substring match does not establish a whole word
Searching for SQL also finds that substring in MySQL. SEARCH does not automatically understand word boundaries or tool names. A skill-classification rule can therefore produce an unwanted category. Decide what surrounding text is allowed before treating the match as a meaningful label.
Similarly, locating example.test somewhere in a string does not validate an address domain. The fragment might belong to a comment or a longer name. For domain comparison, first extract the intended field according to an agreed rule and then compare the whole result. Substring presence is a weaker claim.
The MID entry explains extraction after @. Its example assumes one delimiter and does not claim to be a complete address validator.
No match and an invalid starting position
When the text is not found, SEARCH returns #VALUE!, displayed as #ARG! in Polish Excel. A start below 1 or beyond the text length also causes a VALUE error. Replacing every such result with “not found” can therefore hide an invalid argument.
I do not replace the result with zero without defining its meaning. Valid positions start at 1, but passing zero to another function can create a separate problem. If the reader needs a friendly message, I retain a separate data-quality indicator or handle the error only in the presentation layer.
Exercise: find the second delimiter
In A-B-C, the first hyphen is at position 2. Find the next one by starting at 3. The formula =SEARCH("-","A-B-C",3) should return 4. The result still refers to the whole string, not to a new substring beginning at the third character.
Then change the input to A-B and explain why a second delimiter cannot be found. Add A*B and search for the literal asterisk. These three cases separate starting position, no match, and wildcard behaviour. For a case-sensitive comparison, continue with FIND.
Key takeaways
Is SEARCH case-sensitive?
No. Use FIND when letter case must be respected.
Is the starting position included?
Yes. A character at the stated start can match, and the returned position still counts from the beginning of the complete string.
How do I find a literal asterisk?
Use ~* as the search text. An unescaped asterisk is a wildcard; ~? similarly searches for a literal question mark.
AI was used in an automated way while working on this article. If you want to learn how to do it too, check out this project.
