Find specific text

mattyman

New Member
Joined
Feb 15, 2004
Messages
22
Hello All

I need to pull a specific word from a string of text in a cell and have that word shown in an adjacant cell.
For example A1 will contain the text "Smith Sun Alliance Pension Fund"
I need B2 to show "Pension". I cannot use any filtering or text to columns as the word Pension can be anywhere within the text in A1 and I have thousands of entries. So I need a function.

Help would be as always greatly appreciated.

Thanks

Matt
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Please specify if you need to extract the word by position (e.g. say the 4th word) - or by text (e.g. 'myword')

And....
Of course you can use auto-filter to find / filter records containing the word you are looking for in one specific column (say A) - in the filter conditions dropdown just specify (for example)Contains 'Pension' - this'll find all records containing the word anywhere within the individual cell entries in that column.
 
Upvote 0
The way you describe your query boils down to testing a string whether it contains a substring of interest...

=IF(COUNT(SEARCH("Pension",A1)),"Pension","")
 
Upvote 0
Hi Aladin et all

The formula works well but how would I adapt it to check different words in the same cell. In other words to nest IFS to check say four words in a string.
EG =IF(COUNT(SEARCH("Pension",A1)),"Pension","") Works to pick out Pension in the cell that contains Sun Pension but if I wanted to check other words in the same column that I know it will contain if it does not contain Pension ie Hedge or something

Cheers

Matt
 
Upvote 0
Maybe --
x1.xls
ABCD
1thishastwokeywordsYeskey
2thishasnoneNoword
Sheet1


This is an array formula, which requires entry via Control+Shift+Enter, not just Enter.
 
Upvote 0
mattyman said:
Hi Aladin et all

The formula works well but how would I adapt it to check different words in the same cell. In other words to nest IFS to check say four words in a string.
EG =IF(COUNT(SEARCH("Pension",A1)),"Pension","") Works to pick out Pension in the cell that contains Sun Pension but if I wanted to check other words in the same column that I know it will contain if it does not contain Pension ie Hedge or something

Cheers

Matt

Four different words meaning the same thing or different things? What is the complete list of substrings you want test a cell against?
 
Upvote 0
Hi Aladin

EG =IF(COUNT(SEARCH("Pension",A1)),"Pension","")

Works perfectly it takes the keyword from the string.But
i need to nest the IFS so they search for more than the "Pension" criteria

So in each adjacent cell the formula does exactly as the above but searches for Pension and then Arbritage and then Investment returning each as it is found.Remember that each cell will ONLY contain "Pension" or "Arbritage" or "Investment " etc

Cheers

Matt
 
Upvote 0

Forum statistics

Threads
1,214,786
Messages
6,121,546
Members
449,038
Latest member
Guest1337

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