The Excel SEARCH function is used to find a specific text string within another text string and return its starting position. It’s a helpful tool for locating a word or phrase within a cell’s content.
Syntax
=SEARCH([text_to_find], [within_text], [start_num])
Arguments
text_to_find | The text you want to find within the ‘within_text’. |
within_text | The text in which you want to search for ‘text_to_find’. |
[start_num] | (Optional) The position within ‘within_text’ where the search should start. If omitted, the search starts at the beginning. If specified, the function starts searching from that position. |
How to Use
The SEARCH function is straightforward to use. Let’s look at some examples:
1 |
=SEARCH("apple", "I have an apple and a banana") |
This formula will return 11 because it finds “apple” starting at the 11th position in the text.
1 |
=SEARCH("banana", "I have an apple and a banana") |
Here, it returns 24 as “banana” starts at the 24th position in the text.
1 |
=SEARCH("apple", "I have an apple and a banana", 12) |
By specifying a ‘start_num’ of 12, it returns 19 because it starts the search after the first “apple”.
You can use the SEARCH function to perform various tasks, such as extracting data based on specific keywords or finding patterns within your data.
Keep in mind that SEARCH is not case-sensitive. If you need a case-sensitive search, you should use the FIND function.