Extract the next word

Dharmalingam

New Member
Joined
Jan 8, 2014
Messages
34
Hi All,

I'm having data like below in my sheet, i would like to extract the word which is next to "Buy", could any one pls help me here.

Thanks for your valuable input.
Buy EUR Sell STG</SPAN>
EUR</SPAN>
Buy USD Sell STG</SPAN>
USD</SPAN>
Sell EUR Buy USD</SPAN>
USD</SPAN>
Buy CAD</SPAN>
CAD</SPAN>

<TBODY>
</TBODY>
 
Instead of picking the number after the word Buy i tried to pick the values in between the spaces like below, but it does not work for me, i have used the formula
=MID(A1,FIND(" ",A1)+1,FIND(" ",A1,FIND(" ",A1))-FIND(" ",A1)-1), could you pls help me here! any help will be appreciated. Thanks

buy 100,000 STG100,000
buy 80,000 STG80,000
buy 20,000 STG20,000
buy 5000 STG5,000
buy 4500 STG4,500

<tbody>
</tbody>
Unlike some of your earlier examples, is the number you want to retrieve always going to be the second "word" in the text? If so...

=MID(A1,FIND(" ",A1)+1,FIND(" ",A1,FIND(" ",A1)+1)-FIND(" ",A1)-1)

or, alternately, you could use this one as well...

=TRIM(MID(SUBSTITUTE(A1," ",REPT(" ",99)),100,99))
 
Upvote 0

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Unlike some of your earlier examples, is the number you want to retrieve always going to be the second "word" in the text? If so...

=MID(A1,FIND(" ",A1)+1,FIND(" ",A1,FIND(" ",A1)+1)-FIND(" ",A1)-1)

or, alternately, you could use this one as well...

=TRIM(MID(SUBSTITUTE(A1," ",REPT(" ",99)),100,99))

Brilliant, you are really awesome, all the three formuale are working !!
 
Upvote 0
You may want to give these formulas a try (enter them into B1):

To extract 3-letter words following 'Buy':

=MID(A1,SEARCH("Buy",A1)+4,3)

To extract the number following 'Buy':

=LOOKUP(10^12,--MID(A1,SEARCH("Buy",A1)+4,{1,2,3,4,5,6,7,8,9,10,11,12}))

I am not sure (could not check) if the latter formula works for you, because of my different regional settings for the numbers.
 
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,895
Members
449,097
Latest member
dbomb1414

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