Extracting specific text from string

richardthelionheart

Board Regular
Joined
Mar 25, 2016
Messages
95
Office Version
  1. 2016
Platform
  1. Windows

<colgroup><col width="64"></colgroup><tbody>
[TD="class: xl63, width: 64"]=TRIM(LEFT(SUBSTITUTE(MID(D189,FIND("1",D189),LEN(D189))," ",REPT(" ",5)),5))

I'm using this formula to extract text from a string that begins with 1. {after the word find we see 1}
This works fine except I now want to insert 1 or 2 where we see 1. So any text that begins with 1 or 2.
I'm not sure this is possible ??
I would appreciate any help.


[/TD]

</tbody>
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Hi,

Try this ,not tested...

Ctrl+Shift+Enter NOT just Enter :

=TRIM(LEFT(SUBSTITUTE(MID(D18,MIN(IFERROR(FIND({"1","2"},D18),"")),LEN(D18))," ",REPT(" ",5)),5))
 
Upvote 0
I'm confused as to exact procedure. Normally I copy the formula and paste into the workbook. I'm sorry but I would need detailed instructions as to how you mean, admiral
 
Upvote 0
Hi, here is another option you can try:

=TRIM(LEFT(SUBSTITUTE(MID(D189,FIND(" 1"," "&SUBSTITUTE(D189,"2","1")),LEN(D189))," ",REPT(" ",5)),5))
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,325
Members
452,635
Latest member
laura12345

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