How to Use the SEARCH, SEARCHBs Function in Excel

In spreadsheet applications such as Microsoft Excel and Google Sheets, the SEARCH function is invaluable when it comes to locating specific characters or substrings within a larger text string. This function, designed to find the position of a specified substring, operates independently of case, meaning it does not differentiate between uppercase and lowercase characters.

Basic Syntax

The basic syntax for the SEARCH function is as follows:

=SEARCH(find_text, within_text, [start_num])
  • find_text: The text you are looking to locate.
  • within_text: The body of text within which you are searching for find_text.
  • start_num (optional): The character position to begin the search. If this parameter is omitted, the search starts at the first character.

Examples of Usage

Here are some practical examples to demonstrate how the SEARCH function is used in Excel and Google Sheets.

Finding a Substring

Consider a scenario where cell A1 contains the text string “apple orange banana”, and we need to locate the position of the word “orange”. The formula to achieve this would be:

=SEARCH("orange", A1)

This function will return 7, indicating that “orange” begins at the 7th character of the text string.

Case-Insensitive Search

One of the advantages of the SEARCH function is its case insensitivity. For instance, if we adjust the previous formula to search for “OrAnGe” instead, the function configuration would look like this:

=SEARCH("OrAnGe", A1)

The function still returns 7, emphasizing that it does not consider letter case in its search.

Specifying the Start Position

To tailor where your search begins within the string, you can specify the starting position. For example, to find the second occurrence of the letter “a” in “apple orange banana”, you might use:

=SEARCH("a", A1, SEARCH("a", A1) + 1)

This formula first determines the position of the initial “a” and then begins the subsequent search right after that point to find the next occurrence.

In summary, the SEARCH function is a powerful and flexible tool for locating substrings within larger text entries in Excel and Google Sheets. Familiarity with its syntax and capabilities allows users to effectively navigate and manage the data within their spreadsheets.

More information: https://support.microsoft.com/en-us/office/search-searchb-functions-9ab04538-0e55-4719-a72e-b6f54513b495

Other functions
Returns an array of text values from any specified range
Changes full-width (double-byte) English letters or katakana within a character string to half-width (single-byte) characters
Converts a number to text, using the ß (baht) currency format
Returns the character specified by the code number
Removes all nonprintable characters from text
Returns a numeric code for the first character in a text string
Combines the text from multiple ranges and/or strings, but it doesn't provide the delimiter or IgnoreEmpty arguments
Joins several text items into one text item
Changes half-width (single-byte) English letters or katakana within a character string to full-width (double-byte) characters
Converts a number to text, using the $ (dollar) currency format
Checks to see if two text values are identical
Finds one text value within another (case-sensitive)
Formats a number as text with a fixed number of decimals
Changes half-width (single-byte) characters within a string to full-width (double-byte) characters
Returns the leftmost characters from a text value
Returns the number of characters in a text string
Converts text to lowercase
Returns a specific number of characters from a text string starting at the position you specify
Converts text to number in a locale-independent manner
Extracts the phonetic (furigana) characters from a text string
Capitalizes the first letter in each word of a text value
Replaces characters within text
Repeats text a given number of times
Returns the rightmost characters from a text value
Substitutes new text for old text in a text string
Converts its arguments to text
Formats a number and converts it to text
Combines the text from multiple ranges and/or strings, and includes a delimiter you specify between each text value that will be combined If the delimiter is an empty text string, this function will effectively concatenate the ranges
Removes spaces from text
Returns the Unicode character that is references by the given numeric value
Returns the number (code point) that corresponds to the first character of the text
Converts text to uppercase
Converts a text argument to a number
Returns text from any specified value