Extracting 2 or 3 words before a match found

satish78

Board Regular
Joined
Aug 31, 2014
Messages
218
Hi Friends,

I tried to extract first 2 words using this =TRIM(RIGHT(A1, FIND(B1",SUBSTITUTE(A1, " ", B1,2)&B1)))
below is the text in ColumnA

A1=Refresh staging database use data pump
B1=Data
C1= =TRIM(RIGHT(A1, FIND(B1",SUBSTITUTE(A1, " ", B1,2)&B1)))
some how did not work

Can anyone let me know where I been wrong?
 
in B1:B10

develop
program
engineer
master
architect
patch
designer
data
pump
manager


I know that "data" and "pump" words are present in same cell. But, here I want the formula to pick first come word "data".
 
Upvote 0

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Thanks.

Are we looking for the items of B1:B10 in A1:A10 and return the first item that we come across in A1:A10 or what?
 
Upvote 0
Are we looking for the items of B1:B10 in A1:A10? If we do so, are we picking out the first B item that we come across in A1:A10?
I think the OP is asking for the first word in range B1:B10 (looking down from cell B1 toward cell B10) that appears somewhere in cell A1... then the first word in range B1:B10 that appears somewhere in cell A2... and so on down the list of cells in Column A.
 
Last edited:
Upvote 0
I think the OP is asking for the first word in range B1:B10 (looking down from cell B1 toward cell B10) that appears somewhere in cell A1... then the first word in range B1:B10 that appears somewhere in cell A2... and so on down the list of cells in Column A.

The best thing the OP could do I think is also to publish what A1:A10 houses along with the the expected results (not talk about formulas, etc.).
 
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