How to Extract text from string using a lookup table

HotNumbers

Well-known Member
Joined
Feb 14, 2005
Messages
732
How do I extract text from a string using a lookup Table to identify which string to bring back. example
Excel Workbook
ABCDEFGHIJKL
1Data SourceLookup Table
2
3STRINGRETURNTABLE
424 hour internet accessHome
524 x 7 Communications SupportTravel
63G AccountFax
73G account for IPadiPad
83G Monthly SubscriptionKindle
93G networkOffice
103G Wireless Network accessMonthly
115 days of internet access
1280% of Home internet billIf a string in clumns A has any of the words in column I I would like for columb B
1380% of Home internet invoiceto get pupulated by that Text in column I
1480% of home internet invoice - January 2010
1580% of home internet invoice - July 2010
1680% of Home Internet Invoice - March 2010
1780% of Internet Bill at home
18A T& T Charges - FAX Line
19
20
21
22
Sheet1
Excel 2007
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
How do I extract text from a string using a lookup Table to identify which string to bring back. example

Excel Workbook
ABCDEFGHIJKL
1Data SourceLookup Table
2
3STRINGRETURNTABLE
424 hour internet accessHome
524 x 7 Communications SupportTravel
63G AccountFax
73G account for IPadiPad
83G Monthly SubscriptionKindle
93G networkOffice
103G Wireless Network accessMonthly
115 days of internet access
1280% of Home internet billIf a string in clumns A has any of the words in column I I would like for columb B
1380% of Home internet invoiceto get pupulated by that Text in column I
1480% of home internet invoice - January 2010
1580% of home internet invoice - July 2010
1680% of Home Internet Invoice - March 2010
1780% of Internet Bill at home
18A T& T Charges - FAX Line
19
20
21
22
Sheet1
Excel 2007
It looks like your word table is in column H?

Try this...

=IFERROR(LOOKUP(1E100,SEARCH(H$4:H$10,A4),H$4:H$10),"")

Note that if a string contains more than one keyword the formula will return the word that is closest to the bottom of the list.
 
Upvote 0
Hi,

Well Biff has beaten me to it, but here's my version any how...

=LOOKUP(2^15,SEARCH({"Home";"Travel";"Fax";"iPad";"Kindle";"Office";"Monthly"},A4),$H$4:$H$10)

This will return #N/A if there is no match.
I got this part of the formula...
{"Home";"Travel";"Fax";"iPad";"Kindle";"Office";"Monthly"}
by highlighting $H$4:$H$10 and pressing F9, it's just to show what you are searching for.

Ak
 
Upvote 0
T.Valko.... YOUR posting is also correct and the simplest. CAN YOU please explain to me what 1E+100 means in the formula
 
Upvote 0
T.Valko.... YOUR posting is also correct and the simplest. CAN YOU please explain to me what 1E+100 means in the formula
The result of the SEARCH function will be either an error or a number from 1 to 32,767 (the maximum number of characters that a cell can hold).

For the formula to work correctly we need to find the last number that SEARCH will return. In order to do that we have to use a lookup value that is larger than 32,767.

In the formula I use the lookup value of 1E100 which is scientific notation ("shorthand") for a very large number, 1 followed by 100 zeros. This number is certainly larger than 32,767 so the formula works as expected.

I like to use 1E100 just because it's nice and compact and easy to remember. Technically, all you need to use as the lookup value is ANY number greater than 32,767. So, you could use 32,768 but 1E100 is more compact and is easy to remember.
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,847
Members
452,948
Latest member
UsmanAli786

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