SEARCH in Excel. How it works including examples.

General Description

The SEARCH function in Excel is used to find the position of a specific substring within a string of text. This function is helpful when you need to determine the location of certain characters or words in larger text strings. Unlike the FIND function, SEARCH is case-insensitive, meaning it does not differentiate between uppercase and lowercase letters.

Syntax

The syntax for the SEARCH function is as follows:

SEARCH(find_text, within_text, [start_num])

🧑‍💻 Where:

  • find_text: The substring that you want to find.
  • within_text: The text string in which you want to search.
  • [start_num]: (Optional) The position within the text string to start the search. If omitted, the search begins at the first character of the string.

Example

Let’s say you have a list of email addresses in a spreadsheet, and you want to find out if the domain “example.com” is present in each address.

Assuming the email addresses are in column A, you can use the SEARCH function to check for “example.com” in each address. The formula will look like this:

=SEARCH("example.com", A1)

📌 Where:

  • A1 refers to the first cell in column A containing an email address.

This formula will return the starting position of “example.com” if it exists within the email address. If it doesn’t exist, the function will return a #VALUE! error.

If you want to handle cases where the domain might not be present, you can wrap the SEARCH function in an IFERROR function, as shown below:

=IFERROR(SEARCH("example.com", A1), "Not found")

With this modification, if “example.com” is not found in the email address, the function will return “Not found” instead of an error.