Search a string to find "whole word" from list

colink2

New Member
Joined
Apr 15, 2020
Messages
9
Office Version
  1. 2010
Platform
  1. Windows
Column A contains strings
Column D Contains a list of words to search for

Column B returns true if whole word found

Only return true if whole word is found eg Dog not DogD
If not in list return a null cell

----
If possible I would a more detailed result
Column A contains strings
Column D Contains a list of words to search for
Colun E contains the category for the word in the list of words

Column B returns position of 1st character if word found
Column C returns the category of the whole word found

Fairly sure I will need a VBA fiction for this but beyond my abilities

Any help appreciated.
 

Attachments

  • Find-word-in-list.png
    Find-word-in-list.png
    10.5 KB · Views: 94

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Too late to edit

Both lists could be any length, so it would be good to search the whole columns ignoring any blank cells (which are likley to be a t bottom)
 
Upvote 0
Hi,

According to your description, you can achieve the results with these formulas:

Book3.xlsx
ABCDE
1PositionCategory
2Big Ball5ToyDogAnimal
3Basketball  CatAnimal
4Ballroom  BallToy
5Dog Down1AnimalUmbrella
6DogDog  Fruit
Sheet731
Cell Formulas
RangeFormula
B2:B6B2=IFERROR(LOOKUP(LEN(A2),SEARCH(" "&D$2:D$6&" "," "&A2&" ")),"")
C2:C6C2=IFERROR(LOOKUP(1,1/(SEARCH(" "&D$2:D$6&" "," "&A2&" ")),E$2:E$6),"")
 
Upvote 0
Solution
Compared to everyone I know I am good at using Excel, until I come on this forum seeking help. It is then clear how little I know.
This place is so much more pleasant an experience vs seeking help at stack exchange.

Absolutely perfect answer. Copy & Paste and it works.

I so much prefer a formula vs using VBA.

@jtakw Your help is really appreciated
 
Upvote 0
Another option should you wish to consider it.
Note that my formula and jtakw's will give different results if it is possible that more than one of the words from column D is found in a column A cell.
My formula will return the first word in the column A cell that appears in column D, jtakw's formula will return the last word in the column A cell that appears in column D
For example, in row 7 my formulas return 5/Animal whereas the earlier formula returns 9/Toy.
If multiple matching words are possible, perhaps one suits you better than the other? ?‍♂️

BTW, I suggest that you investigate XL2BB for providing sample data to make it easier for helpers by not having to manually type out sample data to test with. ;)

21 02 05.xlsm
ABCDE
1PositionCategory
2Big Ball Dog5ToyDogAnimal
3Basketball  CatAnimal
4Ballroom  BallToy
5Dog Down1Animal
6DogDog  
7Big Dog Ball5Animal
Lookup
Cell Formulas
RangeFormula
B2:B7B2=IFERROR(AGGREGATE(15,6,SEARCH(" "&D$2:D$4&" "," "&A2&" "),1),"")
C2:C7C2=IF(B2="","",VLOOKUP(MID(A2,B2,FIND(" ",A2&" ",B2)-B2),D$2:E$4,2,0))
 
Upvote 0
You're welcome, glad to help and thanks for the feedback.

PS: Good to see and hear from you Peter :)
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,191
Members
452,616
Latest member
intern444

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