Search multiple cells for keywords, and display a result based on which word is found

Captain Hindsight

New Member
Joined
Oct 9, 2013
Messages
46
I have found the formula below which half applies to my problem.

This displays the correct word, depending on whether cell A1 contains that exact text only (cat, dog or mouse).

=VLOOKUP(A1, {"Cat","Purrs";"Dog","Barks";"Mouse","Squeaks"},2,0)

However I want it to display purrs, barks or squeaks if the cells contain the word cat, dog or mouse in them anywhere e.g. if cell A1 said "xx cat ht".

How can I do this please?
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Hi,

=LOOKUP(2^15,SEARCH({"Cat","Dog","Mouse"},A1),{"Purrs","Barks","Squeaks"})


Regards
 
Upvote 0
My formula looks like this:

=LOOKUP(2^15,SEARCH({"mechanical"},'All Responses'!$F2),{1})

However I want it to look at 'All Responses'!$F2:$G2 and see if either of those cells contain the word "mechanical".

This seems to prevent the formula from working correctly as some cells which worked when I just had F2, now do not return the 1 when I look at both F2 and G2.

Any suggestions?
 
Upvote 0
My formula looks like this:

=LOOKUP(2^15,SEARCH({"mechanical"},'All Responses'!$F2),{1})

However I want it to look at 'All Responses'!$F2:$G2 and see if either of those cells contain the word "mechanical".

This seems to prevent the formula from working correctly as some cells which worked when I just had F2, now do not return the 1 when I look at both F2 and G2.

Any suggestions?

What have you done to that formula?! :)

So you're only searching for one word now? And what do you want the formula to return if either of those two cells contains that word? And if neither does?

This is in effect the reverse of what you originally asked for: there you were searching for mutiple strings within a single cell; now you're searching for a single string in multiple cells! Make your mind up!

Regards
 
Last edited:
Upvote 0
I realised I needed to split those multiple words into having one column each in this tab I'm working in to achieve what I want, so yeah in effect have now reversed my requirement.

I want it to return a 1 if either of the cells contains that word. If neither does I would like it to be blank, so "".

Thanks
 
Upvote 0

Forum statistics

Threads
1,215,174
Messages
6,123,454
Members
449,100
Latest member
sktz

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