Search formula with lookup

bobby_smith

Board Regular
Joined
Apr 16, 2014
Messages
90
Hi All,

I'm trying to write an alternative to formula below:
If(isnumber(search ("Item1",a2)),"Result1",if(isnumber(search("Item2",a2)),"Result2",if(.....

The formula is looking for a specific word in string of text and if found, returning a result.

I'm looking for a more efficient way in the event I have a long list of words I would like to search for and not having to write a long If formula.

I was thinking that I can integrate the search into a Vlookup / Lookup/ Index Match formula so that once the word is found in the string, I can lookup from a table.
I've however not been able to create such a formula.

Your assistance will be greatly appreciated.

Thanks
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Create a table Item - Result and use LOOKUP

Something like this - table in columns D:E


[Table="class: grid"][tr][td="bgcolor: #DCE6F1"][/td][td="bgcolor: #DCE6F1"]
A
[/td][td="bgcolor: #DCE6F1"]
B
[/td][td="bgcolor: #DCE6F1"]
C
[/td][td="bgcolor: #DCE6F1"]
D
[/td][td="bgcolor: #DCE6F1"]
E
[/td][/tr]
[tr][td="bgcolor: #DCE6F1"]
1
[/td][td]
Text​
[/td][td]
Result​
[/td][td][/td][td]
ITEM​
[/td][td]
RESULT​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
2
[/td][td]
blah item3​
[/td][td]
Result3​
[/td][td][/td][td]
Item1​
[/td][td]
Result1​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
3
[/td][td]
item2 blah blah​
[/td][td]
Result2​
[/td][td][/td][td]
Item2​
[/td][td]
Result2​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
4
[/td][td]
item1​
[/td][td]
Result1​
[/td][td][/td][td]
Item3​
[/td][td]
Result3​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
5
[/td][td]
blah item5 blah​
[/td][td]
Result5​
[/td][td][/td][td]
Item4​
[/td][td]
Result4​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
6
[/td][td][/td][td][/td][td][/td][td]
Item5​
[/td][td]
Result5​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
7
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[/table]


Formula in B2 copied down
=LOOKUP(9.99E+307,SEARCH(D$2:D$6,A2),E$2:E$6)

M.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,244
Members
452,622
Latest member
Laura_PinksBTHFT

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