Excel’s SEARCH Function [inc 2 Examples & Troubleshooting]

 

The SEARCH function in Excel is a powerful tool that locates one text string within another.

It returns the starting position of the first text.

We believe is an underrated function, which is why we include it on our Excel courses!

SEARCH Function Details

SEARCH Function in action

 

Available in: All versions of Microsoft Excel
User Level: Beginners
Inputs: Find_text, Within_text, Start_num (optional)
Output: Numeric value representing the starting position of the first text string within the second.
Wildcards: Supports “*” and “?”
Case Sensitive: Yes

 

Where To Find The SEARCH Function

To find the SEARCH function, go to the top of the ribbon on your screen.

Click Formulas > Text, SEARCH Function.

Where to find the SEARCH function in the Formulas tab

Simple Example

Imagine you have a list of email addresses, and you want to know the position of the “@” symbol.

If “john.doe@email.com” is in cell A2, you’d use:

=SEARCH("@", A2)

This would return “9”, indicating the “@” symbol’s position.

Clear example for how the function handles data

The power of SEARCH is being able to look at data inside of cells. Tools like conditional formatting can highlight specific data across cells, but can’t compare the data within them.

Advanced Example

Suppose you’re analyzing social media posts and want to determine the position of hashtags in the text to see if they’re placed at the beginning, middle, or end.

For a cell containing “Check out our new product! #NewRelease”, you can use the SEARCH function to find the position of the first hashtag:

=SEARCH("#", A2)

You can use this alongside the LEN function to see how far along the hashtag is appearing! =LEN(A2)will display the total amount of characters in the cell.

Screenshot of a more complex example using SEARCH and LEN

With these two methods combined, you can easily figure out where the hashtags are appearing within the text at a glance!

excel-promo-2

Troubleshooting & Errors

Let’s delve into the most common challenges and errors users might encounter with the SEARCH function:

Error 1: #VALUE! Error

Problem: This error arises if the text you’re searching for isn’t found.
Solution: Double-check your inputs.

Error 2: Unexpected Results

Problem: The result doesn’t match expectations.
Solution: Make sure there are no leading spaces, use the TRIM function to clean the data!

Error 3: Case Sensitivity Issues

Problem: SEARCH is case-insensitive, which might not be desired.
Solution: Switch to using the FIND function for case-sensitive searches.

 

SEARCH Function Use Cases

  • Email Validation: Determine if an email address contains the “@” symbol and where it’s located.
  • Keyword Analysis: For SEO purposes, determine the position of specific keywords within website content.
  • File Extension Check: For a list of file names, determine if they have certain extensions (e.g., “.jpg” or “.pdf”).

Conclusion

The SEARCH function in Excel is a versatile and invaluable tool for text analysis and manipulation.

Whether you’re validating data, analyzing content, or troubleshooting errors, understanding the intricacies of the SEARCH function can significantly enhance your Excel proficiency.

Its wide range of applications, from simple tasks to advanced data analysis, makes it a must-know function for anyone looking to master Excel.

About Ben Richardson

Ben is a director of Acuity Training which he has been running for over 10 years.


He is a Natural Sciences graduate from the University of Cambridge and a qualified accountant with the ICAEW.


He previously worked as a venture capitalist and banker and so had extensive experience with Excel from building financial models before moving to learn SQL, Microsoft Power BI and other technologies more recently.