Using The SEARCH Function In Excel

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. For example, using “=SEARCH(‘Excel’, ‘I love Excel’)” would yield the result “8”,

Excel Function Details

  • Available in: All versions of Microsoft Excel.
  • User Level: Suitable for both beginners and those looking to enhance their text manipulation skills.
  • Inputs: The SEARCH function requires specific arguments to operate:
    • find_text: The text string that you want to find.
    • within_text: The text string within which to search for the find_text.
    • start_num (optional): The character position in the within_text at which to start searching.
  • Output: Numeric value representing the starting position of the first text string within the second.
  • Data Types:
    • Dates: This function will not work as intended with dates, in the back end Excel uses the amount of days since January 1, 1900 instead of date formats we understand!
    • Numbers: Can search for numbers within text strings if they are entered as text.

Put a quote mark (‘) in front of your number or date so Excel can recognise it as text!

    • Letters: Ideal for searching specific letters or words within text strings.
    • Wildcard: Yes
    • Case Sensitive: No

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.

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.

 

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.

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

For more on the LEN function, click here!

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: Ensure there are no leading or trailing spaces in your text. Use the TRIM function if necessary!

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.