Listing out 5 characters after certain string?

JV63

New Member
Joined
Sep 30, 2009
Messages
44
Hi. I have a string for example like this:

AT R05DD84100TL DAAIA84100OT01A1ZTM DGMFL00991

I want to be able to list out only the 5 characters after "OT". So in the above example it would be 01A1Z.

I can do that in two different cells using:

=MID(A2,FIND("OT",A2)+2,LEN(A2)) which gives me:

01A1ZTM DGMFL00991

<tbody>
</tbody>

And then using:

=LEFT(B2,5) which will give me the 01A1Z

Is there a way to combine those functions or use something different which will give me what I need in one formula?

The OT that I'm looking for isn't always in the same spot of a string. In can be for example:

AT R05DD84100TL DAAIA84100OT01A1ZTM DGMFL00991

ATA02A1DD05100TL AAATM ACAOT03A2CIA05100
ATA02A2DD05300TL DCATM DGBNB OT03A2MNC FF IA05300

Thanks

<colgroup><col></colgroup><tbody>
</tbody>

<tbody>
</tbody>
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
You virtually had it. Instead of using LEN(A2) use 5.

=MID(A2,FIND("OT",A2)+2,5)
 
Upvote 0
Try this.

=MID(A2, FIND("OT",A2)+2,5)
 
Upvote 0
There are simpler options (as shown above), but you have already pretty much done all the work!
Just subsititute your first formula into your second, i.e.
=LEFT(MID(A2,FIND("OT",A2)+2,LEN(A2)),5)
 
Last edited:
Upvote 0
try

=MID(A2,FIND("OT",A2)+2,5)
 
Upvote 0
Thanks everyone for the quick replies. I was close :)

=MID(A2,FIND("OT",A2)+2,5) worked perfectly.
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,192
Members
449,072
Latest member
DW Draft

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