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

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

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

Follow Us

Copyright © 2009 - www.extendoffice.com. | All rights reserved. Powered by ExtendOffice. | Sitemap
Microsoft and the Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.
Protected by Sectigo SSL