SEARCH, SEARCHB in other languages:



privacy

The Excel function: SEARCH, SEARCHB

Description

The SEARCH and SEARCHB functions locate one text string within a second text string, and return the number of the starting position of the first text string from the first character of the second text string. For example, to find the position of the letter "n" in the word "printer", you can use the following function:

=SEARCH("n","printer")

This function returns 4 because "n" is the fourth character in the word "printer."

You can also search for words within other words. For example, the function

=SEARCH("base","database")

returns 5, because the word "base" begins at the fifth character of the word "database". You can use the SEARCH and SEARCHB functions to determine the location of a character or text string within another text string, and then use the MID and MIDB functions to return the text, or use the REPLACE and REPLACEB functions to change the text. These functions are demonstrated in Example 1 in this article.

 Important   SEARCHB counts 2 bytes per character only when a DBCS language is set as the default language. Otherwise SEARCHB behaves the same as SEARCH, counting 1 byte per character.

The languages that support DBCS include Japanese, Chinese (Simplified), Chinese (Traditional), and Korean.



SEARCH, SEARCHB