Skip to main content

Retrieve first list value from a cell

To retrieve the first keyword that are listed in a range from a specific cell, while the cell contains one of several values, you will have to use a rather complex array formula with the INDEX, MATCH, ISNUMBER and SEARCH functions.

retrieve first list value from a cell 1

How to retrieve first list value from a cell?

To get the first corresponding matched keyword that is contained in the cells against the Keywords column as shown above, it means that we need to perform a contain match rather than an exact match. To do so, you can combine the ISNUMBER and SEARCH functions together to get a TRUE and FALSE array. Then use MATCH to locate the first TRUE value and feed the position number to INDEX to retrieve the value at that position.

Generic syntax

=INDEX(keyword_rng,MATCH(TRUE,ISNUMBER(SEARCH(keyword_rng,lookup_cell)),0))

√ Note: This is an array formula that requires you to enter with Ctrl + Shift + Enter.

  • keyword_rng: The range of cells with keywords.
  • lookup_cell: The cell to lookup if it contains the keywords.

To retrieve the first match found in the Keyword list from the cell B5, please copy or enter the formula below in the cell C5, and press Ctrl + Shift + Enter to get the result:

=INDEX(($E$5:$E$7,MATCH(TRUE,ISNUMBER(SEARCH(($E$5:$E$7,B5)),0))

√ Note: The dollar signs ($) above indicate absolute references, which means the keyword_rng in the formula won't change when you move or copy the formula to other cells. However, there are no dollar signs added to the lookup_cell since you want it to be dynamic. After you enter the formula, drag the fill handle down to apply the formula to the below cells.

retrieve first list value from a cell 2

Explanation of the formula

=INDEX(($E$5:$E$7,MATCH(TRUE,ISNUMBER(SEARCH($E$5:$E$7,B5)),0))

  • SEARCH($E$5:$E$7,B5): The SEARCH function returns the position of the keywords from the range $E$5:$E$7 when found in numeric numbers, and the #VALUE! error if not found. The result would be in an array like this: {15;11;#VALUE!}.
  • ISNUMBER(SEARCH($E$5:$E$7,B5)) = ISNUMBER({15;11;#VALUE!}): The ISNUMBER function will convert the numbers in the array to TRUEs and #VALUE! values to FALSEs like this: {TRUE;TRUE;FALSE}.
  • MATCH(TRUE,ISNUMBER(SEARCH($E$5:$E$7,B5)),0) = MATCH(TRUE,{TRUE;TRUE;FALSE},0): The match_type 0 forces the MATCH function to perform an exact match and return the position of the first TRUE in the array {TRUE;TRUE;FALSE}. So, the function will return 1.
  • INDEX(($E$5:$E$7,MATCH(TRUE,ISNUMBER(SEARCH($E$5:$E$7,B5)),0)) = INDEX(($E$5:$E$7,1): The INDEX function then returns the 1st value in the range $E$5:$E$7, which is AAA.

Remark

  • If a cell contains two or more keywords, the formula will return the first keyword listed in the keyword range.
  • The formula is not case-sensitive. To perform a case-sensitive match, you can simply replace the SEARCH function with FIND.
  • You can also replace the keywords list with a hardcoded string as array constant (e.g. {“AAA”}) if you only want to check whether the cells contain this string.

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.

Excel SEARCH function

In Excel, the SEARCH function can help you to find the position of a specific character or substring from the given text string as following screenshot shown. This tutorial, I will introduce how to use this SEARCH function in Excel.


Related Formulas

Retrieve first matching value in cell against a list

Suppose you have a list of keywords, to retrieve the first keyword that appeared in a specific cell, while the cell contains several other values, you will have to use an INDEX and MATCH formula with the help of AGGREGATE and SEARCH functions.

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.

Check if a cell contains a specific text

Here the tutorial provides some formulas to check if a cell contains a specific text and return TRUE and FALSE as below screenshot shown, and explains the arguments and how the formulas works.

Check if cell contains all of many things

Supposing in Excel, there is a list of values in column E, you want to check if the cells in column B contain all of the values in column E, and return TRUE or FALSE as below screenshot shown. Here in this tutorial, it provides a formula to solve this task.

Check if cell contains one of many things

This tutorial provides a formula to check if a cell contains one of several values in Excel, and explains the arguments in the formula and how the formula work.


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