Using the Excel SEARCH Function


The Excel SEARCH function locates a text string within another text string and returns the starting position of the first character from the first text string. For example, to find the position of the letter "c" in "Excel" you would enter =SEARCH("c", "Excel") and the function would return 3.

You can also search for entire words within another word. For example, =SEARCH("walk", "sidewalk") returns 5 since "walk" begins at the fifth character of the word "sidewalk".

SEARCH is very powerful when used with other functions, such as REPLACE and MID.


=SEARCH (find_text, within_text, [start_num])

=SEARCHB (find_text, within_text, [start_num])

Syntax Breakdown

Find Text
Required. The text you want to find.

Within Text
Required. The text in which you want to search for find_text.

Start Num
Optional. Character number in within_text at which you want to start the search.

If this argument is omitted the value is assumed to be 1.

Usage Notes

SEARCH is a powerful function that allows you to find a text string within a second text string. It can be combined with other text functions, such as REPLACE and MID.

Unlike the FIND function, SEARCH allows the use of wildcard characters and is not case-sensitive.

SEARCHB has the same functionality as SEARCH. The main difference is that SEARCHB works with double-byte character sets (DBCS). When a DBCS language is the default, SEARCHB will count 2 bytes per character. If a single-byte character set 9(SBCS) is the default language, SEARCHB will behave the same as SEARCH and count 1 byte per character.

Using Wildcard Characters
You can use wildcard characters such as the question mark (?) and asterisk (*) with SEARCH. Use the question mark to match any single character and the asterisk to match any sequence of characters.

If you need to find a literal question mark or asterisk, place a tilde (~) before the character.

The SEARCH function will return the #VALUE! error in the following instances:
  • If find_text is not found;
  • If start_num is not greater than zero (0) or if the argument is greater than the length of within_text