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.
- Example 1: Search for a character or text in a text string (from the beginning)
- Example 2: Search for a character or text in a text string (with a specified beginning)
- Example 3: Find and extract the text between parentheses
Syntax:
The syntax for the SEARCH function in Excel is:
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:
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:
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:
And all the texts between the parentheses have been extracted at once, see screenshot:
More Functions:
- Excel RIGHT Function
- RIGHT function is used to return the text from right of the text string.
- Excel NUMBERVALUE Function
- The NUMBERVALUE function help to return the real number from number is stored as text.
- 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
Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...
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, Edge and Firefox.