Mid, left right extract.

srizki

Well-known Member
I am using formula =MID(G8,LEFT(32,255),6) OR =MID(G8,32,6) same thing.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
My question is whaat if there are not always 32 characters before the required value, or the value on the right of the is always 5 digit and characters on the left of the value are not the same. <o></o>
So for example. <o></o>
<o> </o>
February 2009 Biomed Charges to 50051-6510<o></o>
I want to extract 50051, so what will be the better formula than the one I am using.<o></o>
<o> </o>
Thanks<o></o>

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

PCL

Well-known Member
Is the number at the end allways ?????-???? it means 5 digits - 4 digits

Yes!

carsten

New Member
you search for the position of text " to ", add the 4 characters of " to " to extract your 5 digit number:

=MID(A1,SEARCH(" to ",A1)+4,5)

unfortunately may not work in all thinkable cases ...

lenze

Legend
Maybe
Code:
``=MID(G8,FIND("-",G8)-5,5)``

lenze

carsten

New Member
Is the number at the end allways ?????-???? it means 5 digits - 4 digits

then this should work:
=MID(G8,LEN(G8)-9,5)

Osvaldo Palmeiro

Well-known Member
=LEFT(RIGHT(A1,10),5)<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>

Thanks to all.

sohail

Replies
4
Views
780
Replies
4
Views
1K
Replies
10
Views
484
Replies
17
Views
1K
Replies
3
Views
236

1,191,399
Messages
5,986,365
Members
440,020
Latest member
IfsandSums

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?

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

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