In this article, I’ll walk you through the key differences, similarities, and practical applications of FIND
and SEARCH
in Excel. We’ll explore everything from basic examples to advanced use cases so that you can leverage these functions efficiently.
Key Takeaways:
- FIND is case-sensitive, requiring exact matches including text case.
- SEARCH is case-insensitive and allows wildcards for more flexible searches.
- FIND and SEARCH return position numbers where the text is found, making them useful for locating substrings in larger text.
- Error handling can be improved by wrapping FIND or SEARCH with functions like IFERROR or IFNA.
- Advanced uses include combining FIND or SEARCH with functions like MID, LEFT, and SUBSTITUTE to extract or replace text.
Unveiling Excel’s Power Tools: FIND and SEARCH Functions
Understanding the Basics of FIND and SEARCH
In Excel, there’s a fine distinction between looking and finding. Delving into this, we uncover FIND and SEARCH functions, which might appear similar at first glance but serve unique purposes. Both are about locating text within cells, but understanding their nuances can transform data handling from a mundane task into an efficient workflow.
Introduction to FIND and SEARCH
Both the FIND
and SEARCH
functions are designed to locate one text string within another and return the starting position of that string. The syntax for both is relatively straightforward, but understanding their differences is crucial for making the right choice based on your needs.
=FIND(find_text, within_text, [start_num])
=SEARCH(find_text, within_text, [start_num])
Let’s break this down:
- find_text: This is the text you want to locate within a larger text string.
- within_text: This is the text string in which you want to search.
- start_num (optional): This optional parameter lets you define the position from which you want to begin the search.
Both functions return the position number of the first character where the search text is found. However, if the text is not found, they return an error.
Differences Between FIND and SEARCH
While both functions appear almost identical in their usage, there are important differences that affect how and when you should use them.
Case Sensitivity:
- FIND is case-sensitive, meaning it distinguishes between uppercase and lowercase letters.
- SEARCH, on the other hand, is not case-sensitive, so it will match both uppercase and lowercase letters.
Let’s say we have the text string “Apple Banana Orange,” and we’re trying to find the word “apple.”
=FIND("apple", "Apple Banana Orange")
will return an error because “apple” with a lowercase “a” doesn’t match the capitalized “Apple.”
=SEARCH("apple", "Apple Banana Orange")
will return 1 because SEARCH ignores case.
Use of Wildcards:
- SEARCH supports the use of wildcards, such as
?
(any single character) and*
(any number of characters). - FIND does not support wildcards.
If you want to find a word starting with “A” in “Apple Banana Orange,” you could use: =SEARCH("A*", "Apple Banana Orange")
, which would return 1, as “Apple” starts with “A” and the wildcard *
accounts for the remaining characters.
Since FIND
doesn’t support wildcards, attempting this with =FIND("A*", "Apple Banana Orange")
would return an error.
Error Handling:
When the search string is not found, both functions return a #VALUE!
error. However, you can wrap the functions within an error-handling function like IFERROR
or IFNA
to make them more user-friendly.
To handle errors gracefully, use:
=IFERROR(FIND(“pear”, “Apple Banana Orange”), “Not Found”)
This would return “Not Found” instead of an error.
Practical Examples of FIND and SEARCH
Extracting Domain from an Email Address
Imagine you have a list of email addresses, and you want to extract the domain (e.g., @gmail.com
or @yahoo.com
). You can use the FIND
or SEARCH
functions in conjunction with the MID
function to extract the domain.
Suppose the email address is in cell A1:
=MID(A2, FIND(“@”, A2), LEN(A2) – FIND(“@”, A2) + 1)
Here’s how this works:
FIND("@", A2)
locates the position of the “@” symbol in the email address.- The
MID
function then extracts the text from that position until the end of the string.
This will give you the domain portion of the email address.
Searching for Specific Words in a Product Description
Let’s say you have a list of product descriptions, and you want to determine if the description contains a specific keyword. You can use the SEARCH
function to check if the keyword is present, as SEARCH isn’t case-sensitive.
If you want to check if the word “Organic” appears in a product description, use:
=IF(ISNUMBER(SEARCH(“organic”, A2)), “Yes”, “No”)
This formula returns “Yes” if “organic” is found, and “No” otherwise.
Extracting a Word from a String Based on Position
If you know the position of a specific word in a sentence, you can use the FIND
function to extract it. Suppose you want to extract the first word from a string.
=LEFT(A2, FIND(” “, A2) – 1)
This formula finds the position of the first space in the string and extracts all the characters before it, giving you the first word.
Combining FIND and SEARCH with Other Excel Functions
Both FIND
and SEARCH
become more powerful when combined with other Excel functions like LEFT
, RIGHT
, MID
, LEN
, and SUBSTITUTE
. Let’s look at some advanced applications.
Using FIND with LEFT to Extract First Names
Imagine you have a full name like “John Michael Smith” and you want to extract just the first name. You can use FIND
in combination with LEFT
.
=LEFT(A2, FIND(” “, A2) – 1)
This formula extracts everything to the left of the first space, effectively isolating the first name.
Extracting the Last Name Using FIND and RIGHT
To extract the last name from “John Doe,” use the FIND
and RIGHT
functions together.
=RIGHT(A2, LEN(A2) – FIND(” “, A2))
This formula calculates the position of the first space and extracts everything to the right of it, giving you the last name.
Common Pitfalls and How to Avoid Them
While FIND
and SEARCH
are straightforward, there are some common mistakes that users make. Here’s how you can avoid them:
- Case Sensitivity Confusion: Always remember that
FIND
is case-sensitive whileSEARCH
is not. If you don’t care about case, default toSEARCH
to avoid errors. - Errors When Text is Not Found: Use
IFERROR
orIFNA
to handle situations where the search text is not found. This can make your formulas more robust and user-friendly. - Start Position: The
start_num
parameter is optional, but if you’re looking for multiple instances of a substring within a string, adjusting this can be useful. However, omitting it will default the search to start at the beginning of the string.
FAQs on Excel’s FIND and SEARCH Functions
How to do a find search on Excel?
To do a find search in Excel, press Ctrl+F
to open the ‘Find and Replace’ dialog box. Type the text you want to find in the ‘Find what’ box. Click ‘Find Next’ to find the next occurrence or ‘Find All’ to list every instance. You can also refine your search by clicking ‘Options’ and choosing to match the case, match the entire cell content, or search within formulas, values, notes, or comments.
What is the difference between Excel find and search?
In Excel, the FIND function is case-sensitive and does not support wildcards, meaning it looks for an exact match including the text case. In contrast, the SEARCH function is case-insensitive and allows wildcards like the asterisk (*) and question mark (?), offering a more flexible search.
How do I use the find formula in Excel?
To use the FIND formula in Excel, type =FIND(”text”, A1)
into a cell, replacing “text” with the string you’re searching for and A1 with the cell reference containing the text. It returns the position of the “text” within the cell, aiding in locating substrings within larger text elements. Remember, FIND is case-sensitive and does not support wildcards.
How Do I Know Whether to Use FIND or SEARCH in Excel?
To decide whether to use FIND or SEARCH in Excel, consider your data’s characteristics. If precise case matching is crucial for your search, opt for FIND. When case sensitivity isn’t relevant, and you may need to employ wildcards to account for various text patterns, then SEARCH is the more adaptable choice for your formula.
Can I Use Wildcards with Both FIND and SEARCH Functions?
No, you cannot use wildcards with the FIND function in Excel; it demands exact matches and does not recognize wildcard characters. However, the SEARCH function does allow wildcards, such as the asterisk (*) and question mark (?), to represent any series of characters or any single character, respectively. This makes SEARCH versatile for pattern matching.
John Michaloudis is a former accountant and finance analyst at General Electric, a Microsoft MVP since 2020, an Amazon #1 bestselling author of 4 Microsoft Excel books and teacher of Microsoft Excel & Office over at his flagship MyExcelOnline Academy Online Course.