Skip to main content

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

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates  |  Delete Blank Rows  |  Combine Columns or Cells without Losing Data  |  Round without Formula ...
Super VLookup: Multiple Criteria  |  Multiple Value  |  Across Multi-Sheets  |  Fuzzy Lookup...
Adv. Drop-down List: Easy Drop Down List  |  Dependent Drop Down List  |  Multi-select Drop Down List...
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  Compare Columns to Select Same & Different Cells ...
Featured Features: Grid Focus  |  Design View  |  Big Formula Bar  |  Workbook & Sheet Manager | Resource Library (Auto Text)  |  Date Picker  |  Combine Worksheets  |  Encrypt/Decrypt Cells  |  Send Emails by List  |  Super Filter  |  Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters ...)  |  50+ Chart Types (Gantt Chart ...)  |  40+ Practical Formulas (Calculate age based on birthday ...)  |  19 Insertion Tools (Insert QR Code, Insert Picture from Path ...)  |  12 Conversion Tools (Numbers to Words, Currency Conversion ...)  |  7 Merge & Split Tools (Advanced Combine Rows, Split Excel Cells ...)  |  ... and more

Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...

Description


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, Edge and Firefox.
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations