Lookup text strings from array in cells and return another value !

x_lringoet

New Member
Joined
Apr 15, 2014
Messages
4
Hi all,

I would like to search the words from cells F2:H5 in the cells A2:A7 and return the value from cell F1 or G1 or H1
in the cells B2:B5

Can anyone help me with a formule I could use to do this lookup.

Thanks a lot in advance.

Kr,

Levi

photos
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
write this formula in B2

=IF(NOT(ISERROR(MATCH(A2,$F$2:$F$6,0))),$F$1,IF(NOT(ISERROR(MATCH(A2,$G$2:$G$6,0))),$G$1,IF(NOT(ISERROR(MATCH(A2,$H$2:$H$6,0))),$H$1,"Match Not Found")))
 
Upvote 0
Hi Shrikant,

this would be correct if the text in the cell A2 would be exactly the same text as one of the cells in F2:F6,
but that is not always the case.



write this formula in B2

=IF(NOT(ISERROR(MATCH(A2,$F$2:$F$6,0))),$F$1,IF(NOT(ISERROR(MATCH(A2,$G$2:$G$6,0))),$G$1,IF(NOT(ISERROR(MATCH(A2,$H$2:$H$6,0))),$H$1,"Match Not Found")))
 
Upvote 0
you can use wild card characters.


Replace A2 in above Formula with

"*"&A2&"*"

=IF(NOT(ISERROR(MATCH("*"&A2&"*",$F$2:$F$6,0))),$F$1,IF(NOT(ISERROR(MATCH("*"&A2&"*",$G$2:$G$6,0))),$G$1,IF(NOT(ISERROR(MATCH("*"&A2&"*",$H$2:$H$6,0))),$H$1,"Match Not Found")))
 
Upvote 0
Hi Shrikant,

still the same problem.
Maybe this can help you :

ABCDEFGH
1HW</SPAN>SW</SPAN>OTHER</SPAN>
2USB Stick</SPAN>Match Not Found</SPAN>PC</SPAN>Adobe</SPAN>Cable</SPAN>
3Microsoft Office</SPAN>USB</SPAN>Microsoft</SPAN>Tool</SPAN>
4Cable 3m</SPAN>Printer</SPAN>Symantec</SPAN>
5Microsoft Office</SPAN>Monitor</SPAN>
6Crimping tool</SPAN>
7large monitor</SPAN>

<TBODY>
</TBODY><COLGROUP><COL><COL><COL span=3><COL><COL><COL></COLGROUP>
 
Upvote 0
Copy this formula in B2,

=IF(SUM(--(IFERROR(SEARCH($F$2:$F$6,A2),0)))<>0,$F$1,IF(SUM(--(IFERROR(SEARCH($G$2:$G$6,A2),0)))<>0,$G$1,IF(SUM(--(IFERROR(SEARCH($H$2:$H$6,A2),0)))<>0,$H$1,"Match Not Found")))


Press Ctrl+Shift+Enter
 
Upvote 0
Or, presuming that there'll only ever be precisely one string from F2:H5 which is found in a given description (you don't say which should take precedence if more than one is found, so presume it's not possible):

=INDEX($F$1:$H$1,,SUMPRODUCT(ISNUMBER(SEARCH(" "&$F$2:$H$5&" "," "&A2&" "))*(COLUMN($F$2:$H$5)-MIN(COLUMN($F$2:$H$5))+1)))


which can also be extended to arbitrarily larger search ranges simply by changing the range (A2:H5) and without the necessity of adding an additional clause to the formula for every new column added to that search range.

Regards
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,982
Messages
6,122,580
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top