Excel SEARCH function

In Excel, the SEARCH function can help you to find the position of a specific character or substring from the given text string as following screenshot shown. This tutorial, I will introduce how to use this SEARCH function in Excel.

 Syntax:

The syntax for the SEARCH function in Excel is:

=SEARCH (find_text, within_text, [start_num])

 Arguments:

  • find_text: Required. The character or text that you want to find.
  • within_text: Required. The text string that is to be searched within.
  • start_num: Optional. From which position you want to start the search within the text string. If this argument omitted, the search starts from the first character of the given text string.

Notes:

  • 1. SEARCH function will return the position of the first occurrence of find_text inside the text string if the start_num is omitted.
  • 2. SEARCH function is not case sensitive, if you need to do a case sensitive search, you should use the FIND function.
  • 3. If the value of find_text is not found, SEARCH function will return the #VALUE! error value.
  • 4. If the start_num is not greater than 0 or is greater than the length of the within_text, the #VALUE! error value is returned as well.
  • 5. The SEARCH function allows using wildcards in the find_text argument:
    • Question mark (?): matches one character;
    • Asterisk (*): matches any series of characters;
    • To find the actual question mark (?) or asterisk (*), type a tilde (~) before them, such as: ~*, or ~?.

 Return:

Return the location of the specific character or text from the given text string.


 Examples:

Example 1: Search for a character or text in a text string (from the beginning)

For searching a specific character or word in a text string to return its position from the first character beginning, please apply the below formula:

=SEARCH(B2, A2)

Note: In the above formula, B2 is the cell contains the character or text you want to find its position, A2 is the text string that you want to search from.

Then, you will get the position of the searched text from the beginning of the text string, see screenshot:


Example 2: Search for a character or text in a text string (with a specified beginning)

Sometime, you may want to get the position of a specific character within a text string from a specific beginning instead of the first character beginning. In this case, you just need to add the third start_num argument.

Please enter or copy the following formula into a blank cell:

=SEARCH(B2, A2,C2)

Note: In the above formula, B2 is the cell contains the character or text you want to find it position, A2 is the text string that you want to search from, and C2 is the number where you want to start the search within the text string.

And then, the positions of the character or text within the text string from where you want to start the search have been returned, see screenshot:


Example 3: Find and extract the text between parentheses

If you have a list of text strings which some texts are enclosed with the parentheses, now, you just want to extract the text between the parentheses, here, the SEARCH function combining the MID function can help you to solve this job.

Please apply the following formula into a blank cell:

=MID(A2,SEARCH("(",A2)+1, SEARCH(")",A2)-SEARCH("(",A2)-1)

And all the texts between the parentheses have been extracted at once, see screenshot:


 More Functions:

  • Excel REPLACE Function
  • The REPLACE function can help you to Find and replace characters based on given location from text string with a new text.

The Best Office Productivity Tools

Kutools for Excel - Helps You To Stand Out From Crowd

Would you like to complete your daily work quickly and perfectly? Kutools for Excel brings 300 powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) and save 80% time for you.

  • Designed for 1500 work scenarios, helps you solve 80% Excel problems.
  • Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands.
  • Become an Excel expert in 3 minutes. No longer need to remember any painful formulas and VBA codes.
  • 30-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years.
Ribbon of Excel (with Kutools for Excel installed)

Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)

  • One second to switch between dozens of open documents!
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Firefox, And New Internet Explorer.
Screen Shot of Excel (with Office Tab installed)
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.

Be the first to comment.