Skip to content

SEARCH

Returns the position of one piece of text inside another, ignoring case and allowing the wildcards ? and *.

Syntax

=SEARCH(, , )

Text

All versions of Excel.

Try it

Edit the formula in C3 or change the inputs. The sheet recalculates as you type.

C3
A
B
C
1
Order
Note
Position of "rush"
2
SO-7719
RUSH: dispatch today
3
SO-7720
Customer asked for a rush
22
4
5

C3 =SEARCH("rush",B3) returns 22

How SEARCH works

SEARCH returns the position of one piece of text inside another. It is the forgiving cousin of FIND: SEARCH ignores upper and lower case and accepts wildcards. Use it when you don't care about capitals, or when part of what you are looking for is unknown.

The arguments

  • find_text is what to look for. =SEARCH("rush",A2) finds RUSH, Rush and rush alike.
  • within_text is the text to search.
  • start_num is where to start. It is optional and defaults to 1.

The result is a number, counted from the first character of within_text as position 1. If the text isn't found, SEARCH returns #VALUE!.

Wildcards

Two characters have special meaning in find_text:

  • ? matches any single character. "k?ttle" matches kettle.
  • * matches any run of characters, including none. "N*h" matches from the first N to the next h.

To search for an actual question mark, asterisk or tilde, put a tilde before it. =SEARCH("~?",A2) finds the position of a literal question mark in Ready?.

Testing whether text contains something

SEARCH returns an error when nothing matches, which makes it easy to build a contains test: =ISNUMBER(SEARCH("rush",A2)) returns TRUE for any note that mentions rush in any case. Combine it with IF for a label: =IF(ISNUMBER(SEARCH("rush",A2)),"Priority","Standard").

COUNTIF and SUMIF accept wildcards in their criteria, so "*rush*" counts the cells that contain rush. Inside an IF or another calculation, SEARCH with ISNUMBER is the usual "contains" test.

Cutting text apart

Like FIND, SEARCH is mostly used to give LEFT, RIGHT or MID a position. =LEFT(A2,SEARCH("@",A2)-1) returns the part of an email address before the @. FIND and SEARCH behave the same here, so pick SEARCH when you want to tolerate case differences, and FIND when case matters.

FIND or SEARCH?

| | FIND | SEARCH | |---|---|---| | Case | Case-sensitive | Ignores case | | Wildcards | No | ? and * | | Not found | #VALUE! | #VALUE! |

In Microsoft 365, =SEARCH("a",A2:A9) returns a result for every cell in the range, spilled down. In older versions, fill the formula down instead.

Wildcard surprises

If the text you search for contains a ? or * that you meant literally, SEARCH treats it as a wildcard and may return the wrong position. Escape it with a tilde. This catches people searching for text like "What?" or product names with an asterisk.

Arguments

find_text
The text to look for. The match ignores case. ? stands for any one character and * for any run of characters. To look for a real ?, * or ~, put a tilde in front of it: "~?".
within_text
The text to search, usually a cell such as A2.
start_numoptional
The position to start searching from, counting the first character as 1. The default is 1. A value below 1 or beyond the end of the text returns #VALUE!. The position returned is still counted from the start of the text.

Examples

Each example is a live sheet. Change the inputs or the formula and watch the result.

Example 1

Case-insensitive position

C3 =SEARCH("rush",B3)

Result: 22

The search ignores case. "Customer asked for a " has 21 characters, so "rush" begins at 22.

C3
A
B
C
1
Order
Note
Position of "rush"
2
SO-7719
RUSH: dispatch today
3
SO-7720
Customer asked for a rush
22
4
5

C3 =SEARCH("rush",B3) returns 22

Example 2

A "contains" test that returns a label

C2 =IF(ISNUMBER(SEARCH("rush",B2)),"Priority","Standard")

Result: Priority

SEARCH finds RUSH even though the formula uses lower case. If B2 had no match, SEARCH would return #VALUE! and ISNUMBER would turn it into FALSE.

C2
A
B
C
1
Order
Note
Priority
2
SO-7719
RUSH: dispatch today
Priority
3
SO-7720
Standard delivery
4
5

C2 =IF(ISNUMBER(SEARCH("rush",B2)),"Priority","Standard") returns Priority

Example 3

Wildcard: ? matches any one character

C2 =SEARCH("k?ttle",A2)

Result: 10

The ? stands for the "e" in kettle. A pattern of "k?ttle" matches six characters starting at position 10.

C2
A
B
C
1
Product
Qty
Position
2
Electric kettle
18
10
3
4

C2 =SEARCH("k?ttle",A2) returns 10

Example 4

Search for a real question mark with ~

C2 =SEARCH("~?",A2)

Result: 6

Without the tilde, ? would match any single character and the formula would return 1.

C2
A
B
C
1
Survey answer
Respondent
Question mark at
2
Ready?
R-118
6
3
4

C2 =SEARCH("~?",A2) returns 6

Your turn.

Solve it in the sheet. Every answer is checked, with hints if you need them.

Task 1 of 2

In C2, show Priority if the note in B2 mentions "rush" in any capitalisation, and Standard otherwise. Fill down to C5.

Answer in C2, then it fills down to C5.

C2
A
B
C
D
1
Order
Note
Priority
2
SO-7719
RUSH: dispatch today
3
SO-7720
Standard delivery
4
SO-7721
Rush job, call first
5
SO-7722
Customer asked for a rush
6
7
Email address
dana.whitfield@example.com
8
Name part
9

Common mistakes

  • SEARCH ignores case. If Rush and RUSH mean different things in your data, use FIND instead.
  • ? and * in the search text are wildcards, even when you meant them literally. Put a tilde in front to search for the real character: "~?".
  • SEARCH returns #VALUE!, not #N/A, when the text isn't found. Wrap it in ISNUMBER or IFERROR to handle the error.
  • A short search string can match in the wrong place. =SEARCH("an",A2) finds "an" inside "Banana" and "Manager". Search for a longer string, or add delimiters.
  • A start_num below 1 or beyond the end of the text returns #VALUE!, even when the text would match earlier on.

Questions people ask

What is the difference between SEARCH and FIND?

SEARCH ignores case and supports the wildcards `?` and `*`. FIND is case-sensitive and treats those characters literally. Otherwise they work the same way.

How do I check if a cell contains a word in Excel?

Use `=ISNUMBER(SEARCH("word",A2))`. It returns TRUE if the word appears anywhere in the cell, in any case, and FALSE otherwise.

How do I search for a question mark or an asterisk?

Put a tilde before the character: `=SEARCH("~?",A2)` or `=SEARCH("~*",A2)`. Without the tilde, SEARCH treats the character as a wildcard.

Why does SEARCH return #VALUE!?

The text isn't in the cell, or start_num is below 1 or beyond the end of the text. Check for typos and extra spaces. If you only want TRUE or FALSE, wrap it in ISNUMBER.

Can SEARCH look for several words at once?

Not directly. Test each word and combine the results, for example `=OR(ISNUMBER(SEARCH("rush",A2)),ISNUMBER(SEARCH("urgent",A2)))`. In Microsoft 365 you can also search an array of words with `SEARCH({"rush","urgent"},A2)` and test it with `COUNT`.

Learn SEARCH in a real sheet.

SEARCH is taught in Logic and text, lesson 12: FIND vs SEARCH. Each lesson is a short, graded exercise like the one above.