Note: The other languages of the website are Google-translated. Back to English
English English

Lookup a value containing specific text with wildcards

To find the first match that contains certain text string in a range in Excel, you can use an INDEX and MATCH formula with wildcard characters - the asterisk (*) and question mark (?).

lookup value with wildcards 1

How to get the value of the first match with wildcards?

To get the first name containing the letter “e” and the first country that has “e” as its 3rd letter from the table as shown above, you should first know how to use the two wildcard characters – the asterisk (*), which matches any number of characters, and question mark (?), which matches only one character. For example, *ice could mean rice, service, ice, @#$ice, etc.; and mo?? could mean more, moon, mo&%, mood, etc. After we grasp the usage of wildcards, we can incorporate them into an INDEX and MATCH formula.

Generic syntax

=INDEX(return_range,MATCH(lookup_value,lookup_array,0))

  • return_range: The range where you want the combination formula to return the first match from. Here refers to the name or country range.
  • lookup_value: The value MATCH used to return the position of the first name or country that meets the given condition in the lookup_array. Here refers to the name containing the letter “e” and the country that has “e” as its 3rd character.
  • lookup_array: The range of cells where the lookup_value is listed. Here refers to the name or country range.
  • match_type 0: Forces MATCH to find the first value that exactly equals to the lookup_value.

To get the first name containing the letter “e” and the first country that has “e” as its 3rd character, please copy or enter the formulas below in the cells F5 and F8, and press Enter to get the results:

Cell F5 =INDEX(B5:B11,MATCH("*e*",B5:B11,0))
Cell F8 =INDEX(C5:C11,MATCH("??e*",C5:C11,0))

lookup value with wildcards 2

Explanation of the formula

=INDEX(B5:B11,MATCH("*e*",B5:B11,0))

  • MATCH("*e*",B5:B11,0): The lookup value *e* can match any word that contains the letter “e”, no matter what position the letter is in the word. (Note that text should be wrapped inside double quotes ("") in Excel formulas.) The match_type 0 asks the MATCH function to find the exact match. The function will then return the position of the first name containing the letter “e” in the range B5:B11, which is 3.
  • INDEX(B5:B11,MATCH("*e*",B5:B11,0)) = INDEX(B5:B11,3): The INDEX function returns the 3rd value in the name range B5:B11, which is Eddie.

=INDEX(C5:C11,MATCH("??e*",C5:C11,0))

  • MATCH("??e*",C5:C11,0): ): The lookup value ??e* can match any word that has “e” as its 3rd character, as long as the word has 3 or more characters. (Note that text should be wrapped inside double quotes ("") in Excel formulas.) The match_type 0 asks the MATCH function to find the exact match. The function will then return the position of the first word that has “e” as its 3rd character in the range C5:C11, which is 3.
  • INDEX(C5:C11,MATCH("??e*",C5:C11,0)) = INDEX(C5:C11,3): The INDEX function returns the 3rd value in the country range C5:C11, which is America.

Related functions

Excel INDEX function

The Excel INDEX function returns the displayed value based on a given position from a range or an array.

Excel MATCH function

The Excel MATCH function searches for a specific value in a range of cells, and returns the relative position of the value.


Related Formulas

Exact Match With INDEX And MATCH

If you need to find out the information listed in Excel about a specific product, movie or a person, etc., you should make a good use of the combination of INDEX and MATCH functions.

Approximate match with INDEX and MATCH

There are times when we need to find approximate matches in Excel to evaluate employees' performance, grade students’ scores, calculate postage based on weight, etc. In this tutorial, we will talk about how to use the INDEX and MATCH functions to retrieve the results we need.

Left Lookup With INDEX And MATCH

To find out information listed in the left columns in an Excel spreadsheet about a given item which is at the right side, you can use the INDEX and MATCH functions. The combination of the two functions possesses an advantage of looking up values in any column over another Excel’s powerful lookup function, the VLOOKUP.


The Best Office Productivity Tools

Kutools for Excel - Helps You To Stand Out From Crowd

Would you like to complete your daily work quickly and perfectly? Kutools for Excel brings 300 powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) and save 80% time for you.

  • Designed for 1500 work scenarios, helps you solve 80% Excel problems.
  • Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands.
  • Become an Excel expert in 3 minutes. No longer need to remember any painful formulas and VBA codes.
  • 30-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years.
Ribbon of Excel (with Kutools for Excel installed)

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, Firefox, And New Internet Explorer.
Screen Shot of Excel (with Office Tab installed)
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Leave your comments
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations