Finding and assigning data to keywords...

kurtgarb798

New Member
Joined
Mar 5, 2009
Messages
6
Hi,

I'm looking for a way to search for certain words in a column and then return specific codes for each word in a different column.

I basically need something like "if A1 contains USA Today then input USAT in B1, if cell A1 contains BBC then return BBC in cell B1, ."

I have a list of 41,000 news headlines in column A like this -

Galveston seawall being repaired after Hurricane Ike - USA Today
Gaza 'looks like earthquake zone' - BBC News
Magnitude-3.1 Earthquake Shakes Reseda Area - MSNBC

and I want to search each one and automatically assign individual abbreviated news agency codes and country names to each news agency listed.

The final database should be split across three columns like this:

"Galveston seawall being repaired after Hurricane Ike - USA Today" - USAT - USA
"Gaza 'looks like earthquake zone' - BBC News" - BBC - UK
"Magnitude-3.1 Earthquake Shakes Reseda Area - MSNBC" - MSNBC - USA

No one in my entire university can figure out how to do this.

Pleas Help!
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
You could use a custom function a bit like this...

Code:
Function InString(rCell As Range)

If InStr(UCase(rCell), "BLUE") Then InString = "Contains Blue"
If InStr(UCase(rCell), "PINK") Then InString = "Contains Pink"
If InStr(UCase(rCell), "YELLOW") Then InString = "Contains Yellow"

End Function

This looks for the three colour words in a string and then returns "Contains Blue" or whatever colour of the three.
 
Upvote 0
Thank you so much for your help. That worked really well and I've managed to use it for a few other things too.

Thanks.
 
Upvote 0

Forum statistics

Threads
1,214,945
Messages
6,122,395
Members
449,081
Latest member
JAMES KECULAH

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