Summary
This step-by-step article describes how to find data in a table (or range of cells) by using various built-in functions in Microsoft Excel. You can use different formulas to get the same result.
Create the Sample Worksheet
This article uses a sample worksheet to illustrate Excel built-in functions. Consider the example of referencing a name from column A and returning the age of that person from column C. To create this worksheet, enter the following data into a blank Excel worksheet.
You will type the value that you want to find into cell E2. You can type the formula in any blank cell in the same worksheet.
A |
B |
C |
D |
E |
||
1 |
Name |
Dept |
Age |
Find Value |
||
2 |
Henry |
501 |
28 |
Mary |
||
3 |
Stan |
201 |
19 |
|||
4 |
Mary |
101 |
22 |
|||
5 |
Larry |
301 |
29 |
Term Definitions
This article uses the following terms to describe the Excel built-in functions:
Term |
Definition |
Example |
Table Array |
The whole lookup table |
A2:C5 |
Lookup_Value |
The value to be found in the first column of Table_Array. |
E2 |
Lookup_Array |
The range of cells that contains possible lookup values. |
A2:A5 |
Col_Index_Num |
The column number in Table_Array the matching value should be returned for. |
3 (third column in Table_Array) |
Result_Array |
A range that contains only one row or column. It must be the same size as Lookup_Array or Lookup_Vector. |
C2:C5 |
Range_Lookup |
A logical value (TRUE or FALSE). If TRUE or omitted, an approximate match is returned. If FALSE, it will look for an exact match. |
FALSE |
Top_cell |
This is the reference from which you want to base the offset. Top_Cell must refer to a cell or range of adjacent cells. Otherwise, OFFSET returns the #VALUE! error value. |
|
Offset_Col |
This is the number of columns, to the left or right, that you want the upper-left cell of the result to refer to. For example, «5» as the Offset_Col argument specifies that the upper-left cell in the reference is five columns to the right of reference. Offset_Col can be positive (which means to the right of the starting reference) or negative (which means to the left of the starting reference). |
Functions
LOOKUP()
The LOOKUP function finds a value in a single row or column and matches it with a value in the same position in a different row or column.
The following is an example of LOOKUP formula syntax:
=LOOKUP(Lookup_Value,Lookup_Vector,Result_Vector)
The following formula finds Mary’s age in the sample worksheet:
=LOOKUP(E2,A2:A5,C2:C5)
The formula uses the value «Mary» in cell E2 and finds «Mary» in the lookup vector (column A). The formula then matches the value in the same row in the result vector (column C). Because «Mary» is in row 4, LOOKUP returns the value from row 4 in column C (22).
NOTE: The LOOKUP function requires that the table be sorted.
For more information about the LOOKUP function, click the following article number to view the article in the Microsoft Knowledge Base:
How to use the LOOKUP function in Excel
VLOOKUP()
The VLOOKUP or Vertical Lookup function is used when data is listed in columns. This function searches for a value in the left-most column and matches it with data in a specified column in the same row. You can use VLOOKUP to find data in a sorted or unsorted table. The following example uses a table with unsorted data.
The following is an example of VLOOKUP formula syntax:
=VLOOKUP(Lookup_Value,Table_Array,Col_Index_Num,Range_Lookup)
The following formula finds Mary’s age in the sample worksheet:
=VLOOKUP(E2,A2:C5,3,FALSE)
The formula uses the value «Mary» in cell E2 and finds «Mary» in the left-most column (column A). The formula then matches the value in the same row in Column_Index. This example uses «3» as the Column_Index (column C). Because «Mary» is in row 4, VLOOKUP returns the value from row 4 in column C (22).
For more information about the VLOOKUP function, click the following article number to view the article in the Microsoft Knowledge Base:
How to Use VLOOKUP or HLOOKUP to find an exact match
INDEX() and MATCH()
You can use the INDEX and MATCH functions together to get the same results as using LOOKUP or VLOOKUP.
The following is an example of the syntax that combines INDEX and MATCH to produce the same results as LOOKUP and VLOOKUP in the previous examples:
=INDEX(Table_Array,MATCH(Lookup_Value,Lookup_Array,0),Col_Index_Num)
The following formula finds Mary’s age in the sample worksheet:
=INDEX(A2:C5,MATCH(E2,A2:A5,0),3)
The formula uses the value «Mary» in cell E2 and finds «Mary» in column A. It then matches the value in the same row in column C. Because «Mary» is in row 4, the formula returns the value from row 4 in column C (22).
NOTE: If none of the cells in Lookup_Array match Lookup_Value («Mary»), this formula will return #N/A.
For more information about the INDEX function, click the following article number to view the article in the Microsoft Knowledge Base:
How to use the INDEX function to find data in a table
OFFSET() and MATCH()
You can use the OFFSET and MATCH functions together to produce the same results as the functions in the previous example.
The following is an example of syntax that combines OFFSET and MATCH to produce the same results as LOOKUP and VLOOKUP:
=OFFSET(top_cell,MATCH(Lookup_Value,Lookup_Array,0),Offset_Col)
This formula finds Mary’s age in the sample worksheet:
=OFFSET(A1,MATCH(E2,A2:A5,0),2)
The formula uses the value «Mary» in cell E2 and finds «Mary» in column A. The formula then matches the value in the same row but two columns to the right (column C). Because «Mary» is in column A, the formula returns the value in row 4 in column C (22).
For more information about the OFFSET function, click the following article number to view the article in the Microsoft Knowledge Base:
How to use the OFFSET function
Need more help?
Want more options?
Explore subscription benefits, browse training courses, learn how to secure your device, and more.
Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.
Transcript
In this lesson, we’ll look at how to find things in Excel.
Let’s take a look.
To find a value in Excel, use the Find and Replace dialog box. You can access this dialog using the keyboard shortcut control-F, or, by using the Find and Select menu at the far right of the Home tab on the ribbon.
Let’s try looking for the name Ann. Nothing happens until we click the Find Next button. Then, each time we click, Excel finds another match.
Note that Excel finds other names that contain Ann as well—Annie, Ann, Danny, and then Hannah. If we continue clicking Find Next, Excel will eventually return to the first match.
By default, Excel searches left to right, first through rows, then columns. You can hold down the shift key when you press «Find Next» to move backwards.
Now let’s review the Find options.
The first option allows you to restrict the search to the current worksheet, or expand it to include the entire workbook. If we select workbook, Excel will now find matches on Sheet 2.
The «search» option determines the order that Excel looks through cells. The default is «By Rows.» If we switch to «By Columns,» Excel will find all matches in one column before moving on to the next column.
There is also an option to search Formulas, Values, and Comments. We’ll look at these in a future lesson.
If we enable «Match case,» Excel treats case as important and only finds values that begin with a capital A.
If we enable «Match entire cell contents,» Excel will only find cells where the value is exactly Ann. This is a good way to find only the name Ann.
With the Find dialog closed, you can still find things with the keyboard shortcut Shift F4. Excel will use the current Find settings and select the next match.
Finally, it’s important to understand that if you have more than one cell selected, Excel will search only in the current selection. For example, if we select just a subset of our table, Excel will only search in that selection.
However, if you switch «Within» to «Workbook,» Excel will drop the current selection and search all cells. At this point, you can switch back to Worksheet to search only the current worksheet.
When working with Excel, we see so many peculiar situations. One of those situations is searching for the particular text in the cell. The first thing that comes to mind when we say we want to search for a specific text in the worksheet is the “Find and Replace” method in Excel, which is the most popular one. But Ctrl + F can find the text you are looking for but cannot go beyond that. So, for example, if the cell contains certain words, you may want the result in the next cell as “TRUE” or “FALSE.” So, Ctrl + F stops there.
Table of contents
- How to Search For Text in Excel?
- Which Formula Can Tell Us A Cell Contains Specific Text?
- Alternatives to FIND Function
- Alternative #1 – Excel Search Function
- Alternative #2 – Excel Countif Function
- Highlight the Cell which has Particular Text Value
- Recommended Articles
Here, we will take you through the formulas to search for the particular text in the cell value and arrive at the result.
You can download this Search For Text Excel Template here – Search For Text Excel Template
Which Formula Can Tell Us A Cell Contains Specific Text?
It is a question we have seen many times in Excel forums. The first formula that came to mind was the “FIND” function.
The FIND function can return the position of the supplied text values in the string. So, if the FIND method returns any number, then we can consider the cell as it has the text or else not.
- For example, look at the below data.
- In the above data, we have three sentences in three different rows. Now in each cell, we need to search for the text “Best.” So, apply the FIND function.
- The “find_text” argument mentions the text we need to find.
- For the “within_text,” select the full sentence, i.e., cell reference.
- The last parameter is not required to close the bracket and press the “Enter” key.
So, in two sentences, we have the word “best.” We can see the error value of #VALUE! in cell B2, which shows that cell A2 does not have the text value “best.”
- Instead of numbers, we can also enter the result in our own words. For this, we need to use the IF condition.
So, in the IF condition, we have supplied the result as “Text Found” if the value “best” is found. Otherwise, we have provided the result as “Not Found.”
But, here we have a problem, even though we have supplied the result as “Not Found,” if the text is still not found, we are getting the error value as #VALUE!.
So, nobody wants to have an error value in their Excel sheet. Therefore, we must enclose the formula with the ISNUMERIC function to overcome this error value.
The ISNUMERIC function evaluates whether the FIND function returns the number or not. If the FIND function returns the number, it will supply TRUE to the IF condition or else FALSE condition. Based on the result provided by the ISNUMERIC function, the IF condition will return the result accordingly.
We can also use the IFERROR function in excelThe IFERROR function in Excel checks a formula (or a cell) for errors and returns a specified value in place of the error.read more to deal with error values instead of ISNUMERIC. For example, the below formula will also return “Not Found” if the FIND function returns the error value.
Alternatives to FIND Function
Alternative #1 – Excel Search Function
Instead of the FIND function, we can also use the SEARCH function in excelSearch function gives the position of a substring in a given string when we give a parameter of the position to search from. As a result, this formula requires three arguments. The first is the substring, the second is the string itself, and the last is the position to start the search.read more to search the particular text in the string. The syntax of the SEARCH function is the same as the FIND function.
Supply the “find_text” as “Best.”
The “within_text” is our cell reference.
Even the SEARCH function returns an error value as #VALUE! If the finding text “best” is not found. As we have seen above, we need to enclose the formula with ISNUMERIC or IFERROR functions.
Alternative #2 – Excel Countif Function
Another way to search for a particular text is using the COUNTIF functionThe COUNTIF function in Excel counts the number of cells within a range based on pre-defined criteria. It is used to count cells that include dates, numbers, or text. For example, COUNTIF(A1:A10,”Trump”) will count the number of cells within the range A1:A10 that contain the text “Trump”
read more. This function works without any error.
In the range, the argument selects the cell reference.
In the criteria column, we need to use a wildcard in excelIn Excel, wildcards are the three special characters asterisk, question mark, and tilde. Asterisk denotes multiple characters, a question mark denotes a single character, and a tilde denotes the identification of a wild card character.read more because we are just finding the part of the string value, so enclose the word “best” with an asterisk (*) wildcard.
This formula will return the word “best” count in the selected cell value. Since we have only one “best” value, we will get only 1 as the count.
We can apply only the IF condition to get the result without error.
Highlight the Cell which has a Particular Text Value
If you are not a fan of formulas, you can highlight the cell with a particular word. For example, to highlight the cell with the word “best,” we need to use conditional formatting in excelConditional formatting is a technique in Excel that allows us to format cells in a worksheet based on certain conditions. It can be found in the styles section of the Home tab.read more.
First, select the data cells and click “Conditional Formatting” > “New Rule.”
Under “New Rule,” select the “Format only cells that contain” option.
From the first dropdown, select “Specific Text.”
The formula section enters the text we search for in double quotes with the equal sign. =’best.’
Then, click on “FORMAT” and choose the formatting style.
Click on “OK.” It will highlight all the cells which have the word “best.”
Using various techniques, we can search the particular text in Excel.
Recommended Articles
This article is a guide to Search For Text in Excel. Here, we discuss the top three methods to search the cell value for a specific text and arrive at the result with practical examples and a downloadable Excel template. You may learn more about Excel from the following articles: –
- Find Links in Excel
- Using Find and Select in Excel
- Search Box in Excel
This tutorial demonstrates how to use the FIND Function in Excel and Google Sheets to find text within text.
What Is the FIND Function?
The Excel FIND Function tries to find string of text within another text string. If it finds it, FIND returns the numerical position of that string.
Note: FIND is case-sensitive. So, “text” will NOT match “TEXT”. For case-insensitive searches, use the SEARCH Function.
How to Use the FIND Function
To use the Excel FIND Function, type the following:
=FIND("e", "elephant")
In this case, Excel will return the number 1, because “e” is the first character in the string “elephant”.
Let’s take a look at some more examples:
Start Number (start_num)
The start number tells FIND what numerical position in the string to start looking from. If you don’t define it, FIND will start from the beginning of the string.
=FIND(B3,C3)
Now let’s try defining a start number of 2. Here, we see that FIND returns 3. Because it starts looking from the second character, it misses the first “e” and finds the second:
=FIND(B3,C3,D3)
Start Number (start_num) Errors
If you want to use a start number, it must:
- be a whole number
- be a positive number
- be smaller than the length of the string you are looking in
- not refer to a blank cell, if you define it as a cell reference
Otherwise, FIND will return a #VALUE! error as shown below:
Unsuccessful Searches Return a #VALUE! Error
If FIND does not locate the string you’re looking for, it will return a value error:
FIND is Case-Sensitive
In the example below, we’re searching for “abc”. FIND returns 10 because it is case-sensitive – it ignores “ABC” and the other variations:
FIND Does Not Accept Wildcards
You cannot use wildcards with FIND. Below, we’re looking for “?000”. In a wildcard search, this would mean “any character followed by three zeroes”. But FIND takes this literally to mean “a question mark followed by three zeroes”:
The same applies to the asterisk wildcard:
Instead, to search text with wildcards, you can use the SEARCH Function:
How to Split First and Last Names from a Cell with FIND
If your spreadsheet has a list of names with both the first and last names in the same cell, you might want to split them out to make sorting easier. FIND can do that for you – with a little help from some other functions.
Getting the First Name
The LEFT Function returns a given number of characters from a string, starting from the left.
We can use it to get the first name, but since names are different lengths, how do we know how many characters to return?
Easy – we just use FIND to return the position of the space between the first and last name, subtract 1 from that, and that’s how many characters we tell LEFT to give us.
The formula looks like this:
=LEFT(B3,FIND(“ “,B3)-1)
Getting the Last Name
The RIGHT Function returns a given number of characters from a string, starting from the right.
We have the same problem here as with the first name, but the solution is different, because we have to get the number of characters between the space and the right edge of the string, not the left.
To get that, we use FIND to tell us where the space is, and then subtract that number from the total number of characters in the string, which the LEN Function can give us.
The formula looks like this:
=RIGHT(B3,LEN(B3)-FIND(" ",B3))
If the name contains a middle name, note that it will be split into the last name cell.
Finding the nth Character in a String
As noted above, FIND returns the position of the first match it finds. But what if you want to find the second occurrence of a particular character, or the third, or fourth?
This is possible with FIND, but we’ll need to combine it with a couple of other functions: CHAR and SUBSTITUTE.
Here’s how it works:
- CHAR returns a character based on its ASCII code. For example, =CHAR(134) returns the dagger symbol.
- SUBSTITUTE goes through a string and lets you swap out a character for any other one.
- With SUBSTITUTE you can define an instance number, meaning it can swap the nth occurrence of a given string for anything else.
- So, the idea is, we take our string, use SUBSTITUTE to swap the instance of the character we want to find for something else. We’ll use CHAR to swap it for something that is unlikely to be found in the string, then use FIND to locate that obscure substitute.
The formula looks like this:
=FIND(CHAR(134),SUBSTITUTE(D3,C3,CHAR(134),B3))
And here’s how it works in practice:
FIND Vs SEARCH
FIND and SEARCH are very similar – they both return the position of a given character or substring within a string. However, there are some differences:
- FIND is case sensitive but SEARCH is not
- FIND does not allow wildcards, but SEARCH does
You can see a few examples of these differences below:
FIND in Google Sheets
The FIND Function works exactly the same in Google Sheets as in Excel:
Additional Notes
The FIND Function is case-sensitive.
The FIND Function does not support wildcards.
Use the SEARCH Function to use wildcards and for non case-sensitive searches.
FIND Examples in VBA
You can also use the FIND function in VBA. Type:
application.worksheetfunction.find(find_text,within_text,start_num)
For the function arguments (find_text, etc.), you can either enter them directly into the function, or define variables to use instead.
Find in Excel (Table of Contents)
- Using Find and Select Feature in Excel
- FIND Function in Excel
- SEARCH Function in Excel
Introduction to Find in Excel
There are two ways to find it in Excel. First, we can use Find by pressing Ctrl + F shortcut keys. Therein Find and Replace box, search the word or field which we want to find in the Find What section. In another way, we can use the FIND function. For this, select the Find function from the insert function and, as per syntax, select the substring from where we need to find it, and choose the word or letter or number which we want to find in the String position. This will return the position of the chosen string from the selected Substring.
Methods to Find in Excel
Below are the different methods to find in excel.
You can download this Find in Excel Template here – Find in Excel Template
Method #1 – Using Find and Select Feature in Excel
Let’s see How to Find a Number or a Character in Excel using the Find and Select feature in Excel.
Step 1 – Under the Home tab, in the Editing group, click Find & Select.
Step 2 – To find text or numbers, click Find.
- In the Find what box, type the text or character you want to search for, or click the arrow in the Find what box and then click a recent search in the list.
Here, we have a record of marks of four students. Suppose we want to find the text ‘envy’ in this table. For this, we click Find and Select under the Home tab then the Find and Replace dialog box appears. In the Find what box, we enter ‘envy’ then click on Find All. We get the text ‘envy’ is in cell number A5.
- You can use wildcard characters, such as an asterisk (*) or a question mark (?), in your search criteria:
Use the asterisk to find any string of characters.
Suppose we want to find text in the table which starts with the letter ‘j’ and ends with the letter ‘n’. In the Find and Replace dialog box, we enter ‘j*n’ in the Find what box, then click on Find All.
We will get the result as text ‘j*n’(john) is in the cell no. ‘A2’ because we have only one text which starts with ‘j’ and ends with ‘n’ with any number of characters between them.
Use the question mark to find any single character.
Suppose we want to find text in the table that starts with the letter ‘k’ and ends with the letter ‘n’ with a single character. So, in the Find and Replace dialog box, we enter ‘k?n’ to find what box. Then click on Find All.
Here, we get the text ‘k?n’(kin) is in cell no. ‘A4’ because we have only one text which starts with ‘k’ and ends with ‘n’ with a single character between them.
- Click Options to further define your search if needed.
- We can find text or number by changing settings in the Within, Search and Look in the box according to our needs.
- To show the working of the above-mentioned options, we took the data as follows.
- To search case-sensitive data, select the Match case check box. It gives you output in the case you give input in the Find What box. For example, we have a table of some cars’ names. If you type ‘ferrari’ in the Find What box, then it will find only ‘ferrari’, not ‘Ferrari’.
- To search for cells that contain just the characters you typed in the Find what box, select the Match entire cell contents checkbox. For example, we have a table of some cars’ names. Type ‘Creta’ in the Find What box.
- It will then find cells containing exactly ‘Creta’, and cells containing ‘Cretaa’ or ‘Creta car’ will not be found.
- If you want to search for text or numbers with specific formatting, click Format, and then make your selections in the Find Format dialog box according to your need.
- Let us click the Font option and select the Bold, and click OK.
- Then, we click on Find All.
We get the value as ‘elisa’, which is in the ‘A3’ cell.
Method #2 – Using FIND Function in Excel
The FIND function in Excel gives the location of a substring within a string.
Syntax For FIND in Excel:
The first two parameters are required, and the last parameter is non-compulsory.
- Find_Value: The substring which you want to find.
- Within_String: The string in which you want to find the specific substring.
- Start_Position: It is a non-compulsory parameter and describes from which position we want to search substring. If you do not describe it, then start the search from the 1st position.
For example =FIND(“o”, “Cow”) gives 2 because “o” is the 2nd letter in the word “cow“.
FIND(“j”, “Cow”) gives an error because there is no “j” in “Cow”.
- If the Find_Value parameter contains multiple characters, the FIND function gives the location of the first character.
E.g., the formula FIND(“ur”, “hurry”) gives 2 because “u” in the 2nd letter in the word “hurry”.
- If Within_String contains multiple occurrences of Find_Value, the first occurrence is returned. For example, FIND (“o”, “wood”)
gives 2, which is the location of the first “o” character in the string “wood”.
The Excel FIND function gives the #VALUE! error if:
- If Find_Value does not exist in Within_String.
- If Start_Position contains multiple characters as compared to Within_String.
- If Start_Position either has a zero or negative number.
Method #3 – Using SEARCH Function in Excel
The SEARCH function in Excel is simultaneous to FIND because it also gives the location of a substring in a string.
- If Find_Value is the blank string “, the Excel FIND formula gives the string’s first character.
Example =SEARCH (“ful“, “Beautiful) gives 7 because the substring “ful” begins at the 7th position of the substring “beautiful”.
=SEARCH (“e”, “MSExcel”) gives 3 because “e” is the 3rd character in the word “MSExcel” and ignoring the case.
- Excel’s SEARCH function gives the #VALUE! error if:
- If the value of the Find_Value parameter is not found.
- If the Start_Position parameter is superior to the length of Within_String.
- If the Start_Position either equal to or less than 0.
Things to Remember About Find in Excel
- Asterisk defines a string of characters, and the question mark defines a single character. You can also find asterisks, question marks, and tilde characters (~) in worksheet data by preceding them with a tilde character inside the Find what option.
For example, to find data that contain “*”, you would type ~* as your search criteria.
- If you want to find cells that match a specific format, you can delete any criteria in the Find what box and select a specific cell format as an example. Click the arrow next to Format, click Choose Format From Cell, and click the cell with the formatting you want to search for.
- MSExcel saves the formatting options you define; you should clear the formatting options from the last search by clicking on an arrow next to Format and then Clear Find Format.
- The FIND function is case sensitive and does not allow while using wildcard characters.
- The SEARCH function is case-insensitive and allows while using wildcard characters.
Recommended Articles
This is a guide to Find in Excel. Here we discuss how to use the Find feature, Formula for FIND, and SEARCH in Excel, along with practical examples and a downloadable excel template. You can also go through our other suggested articles –
- FIND Function in Excel
- Excel SEARCH Function
- Find and Replace in Excel
- Search For Text in Excel