Excel find() function
The find() is a built-in method of Excel to find a text string into another string. As a resultant value, it returns the position of the first string where it finds in the second string. If it does not get the first string available inside another string, it returns #VALUE! error.
The find() function is a case-sensitive function and does not support wildcard operators. If this function found more than one occurrence of the string, it returns the position for the first occurrence. For example, for the substring "t", inside "Javatpoint", it will return 5 (first occurrence of t).
This chapter will cover each parameter for this function and describe it in detail.
The main purpose of using this function is to find a string inside another string and get its position.
This function works same as the Excel prebuilt FIND option that is used to search something (number, string) in an Excel file. But it just navigates you to the text when found.
The find() function returns the position of the first string where it is found inside the second string.
If it does not find the string, it returns an error called #VALUE!.
The find() function takes mainly two arguments. Syntax with two mandatory parameters will be -
Additionally, Excel also allows to set a position to start searching of the string from a specific position. For this, the syntax will be -
Points about find() function
Below is some essential information about the find() function that you should know while working with it.
There is a list of examples containing results for different expressions.
You can implement these expressions in an Excel worksheet and verify that they are returning the same result.
Let's take an Excel worksheet containing some string or numeric data inside it. We will apply the find() function to search the substring inside another string stored in this Excel sheet.
Steps to implement find() function on Excel data
Step 1: We have taken some data in an Excel worksheet where column A is holding the searching string and Column B with which string will be searched.
When substring is present in string
Step 2: Perform the first finds operation on first row data and write the following formula in C2 cell.
Step 3: See that the find() function returned 3 as it find the vat substring at position 3rd inside Javatpoint string.
When substring is not present in string
Step 4: Now, check for others for the next substring. So, modify the above formula like this and write in C3 cell.
Step 5: It has now returned an error called #VALUE! as find() function does not found k inside Javatpoint string.
When substring is not provided
In case, if the user does not any substring to search, let's see what it returns.
Step 6: Write the following formula for row 4 where A4 cell does not containing any substring to search.
Step 7: This time it has returned 1. Excel find() function always returns 1 if the user don't pass any substring to be searched.
Step 8: Similarly, apply the find() function on other data and see the returned positions corresponding to each comparison.
We have also added remarks for each result.
Example 3: Provide [startFrom] parameter
All the examples that you have learned above are solved without specifying the search start [startFrom] parameter. Let's see an example, how the find() function works if we use third (optional) [startFrom] parameter.
Step 1: We have taken the following dataset along with startFrom parameter to start the search from a specified position.
Step 2: Write the following formula for row 3 data, in which the find() function will start searching at position 5.
=FIND(A2, B2, C2)
Step 3: It did not find the substring : come inside the String : Welcome to Javatpoint after start searching at position 5.
Thus, it returned #VALUE! error.
Step 4: Now, perform the same operation on other cells data and use the following formula:
=FIND(A3, B3, C3)
Step 5: This time it found the specified substring inside the main string even after start searching at position 7 and returned position 9.
Example 3: find() with ISNUMBER()
This time we want results as either TRUE or FALSE for a substring inside another string. We will use the find() function nested inside ISNUMBER() function as get result as TRUE or FALSE. Use the functions as described to get the result as a Boolean value rather than position.
We have an example in which we will use the find() function inside ISNUMBER() to get the result as a Boolean value (either true or false).
Step to find string and get result as Boolean value
Step 1: We will use the same data used in first example that was containing the substrings and string on which we will perform this modified operation.
We have added one more column named Boolean Result to store the Boolean result.
Step 2: Write the formula as following -
Step 3: It found the substring (A2) inside string (B2). Hence, it returned TRUE.
Step 4: Now, we have applied the same formula on all the remaining data and get the result for them.
Look at the remark for each operation so that you can understand it better.
Difference between find() and search()
You are wondering that why not use the search() function instead of find(). Just like the find() function, search() function is also used to find a string inside another string and returns the position of searched string. Also, they have some differences.
There are some differences between them that is why they are used in different circumstances.