Forum

Notifications
Clear all

Modification: Excel Search a Cell for a List of Words

5 Posts
4 Users
0 Reactions
134 Views
(@spearmint)
Posts: 1
New Member
Topic starter
 

Hi all,

 

I'm trying to use the formula found in the following link:  https://www.myonlinetraininghub.com/excel-search-string-for-a-list-of-words. However, I cannot work out how to add a larger list. What I have tried to do is extend the list variable to being 4 cells rather than 3 and then changed the ROW($1:$3) term to be ROW($1:$4). That does not work. 

 

Any suggestions? 

 

Thanks. 

 
Posted : 24/11/2018 8:36 am
(@mynda)
Posts: 4761
Member Admin
 

Hi,

Use the "SEARCH Not Case Sensitive Array Formula" and change the ROW reference to match the number of items in your 'List'. e.g. if you add one more item to the 'List' your formula would be:

<pre>=INDEX(list,LARGE(IF(ISNUMBER(SEARCH(list,A2)),ROW($1:$4)),1))</pre>

Entered with CTRL+SHIFT+ENTER as it's an array formula.

Mynda

 
Posted : 25/11/2018 9:05 pm
(@debaser)
Posts: 837
Member Moderator
 

You could also use LOOKUP like this:

=IFERROR(LOOKUP(1E+100,1/SEARCH(list,A2),list),"No match")

 
Posted : 27/11/2018 5:53 am
Anders Sehlstedt
(@sehlsan)
Posts: 972
Prominent Member
 

Hi,

It is a nice trick Velouria, I had to play around a little to understand what it does. This is why I like this forum, you get to learn new ways to work with Excel.
I noticed though that as you divide 1 by the result of the SEARCH function, the value will never exceed 1, so you should be able to lookup 1 instead of 1E+100 (or 1E+306 as I have seen in many other examples).

Have I got it correct?

/Anders

 
Posted : 27/11/2018 5:17 pm
(@debaser)
Posts: 837
Member Moderator
 

Hi Anders,

 

You are correct. It’s force of habit I think that made me write 1E100! In truth, you could either use:

=IFERROR(LOOKUP(1E+100,SEARCH(list,A2),list),"No match")

or:

=IFERROR(LOOKUP(1,1/SEARCH(list,A2),list),"No match")

 
Posted : 28/11/2018 3:28 am
Share: