Extract variable data string

pyrodag

New Member
Joined
Oct 10, 2022
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi, I'm trying to extract sale order numbers in a certain format but they have recently jumped up in character length so current formula doesn't work for all cells.

Current formula is =MID(P2,4,7)
This worked fine where number was 0001234567/00100.

Now we have numbers such as 0123456789/00100

I just want to return the number with no leading zeroes and not including the last 6 digits which always begin with a slash.

Can someone help? I seem to do fine using left or right to do one thing but can't get both.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Hi & welcome to MrExcel.

Can you post about half a dozen of the strings you start with.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.

Also do you have the TEXTBEFORE function yet?
 
Upvote 0
Hi & welcome to MrExcel.

Can you post about half a dozen of the strings you start with.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.

Also do you have the TEXTBEFORE function yet?
I do not have textbefore, this on my works pc so can't download the add-in.
I have created a small sample and taken an image however.
The cells with slightly longer numbers are incorrectly cut using MID by itself.
Simply has to be without leading zeroes (variable) and without last 6 digits or "/" and after (constant)
 

Attachments

  • Screenshot_20221010-193223__01.jpg
    Screenshot_20221010-193223__01.jpg
    171.6 KB · Views: 12
Upvote 0
Ok, thanks for that, how about
Fluff.xlsm
AB
10001234567/001001234567
20123456789/00100123456789
Main
Cell Formulas
RangeFormula
B1:B2B1=LEFT(A1,FIND("/",A1)-1)+0
 
Upvote 0
Ok, thanks for that, how about
Fluff.xlsm
AB
10001234567/001001234567
20123456789/00100123456789
Main
Cell Formulas
RangeFormula
B1:B2B1=LEFT(A1,FIND("/",A1)-1)+0
Thanks, that has worked fine in getting the correct format showing. Would that have a negative impact on a vlookup that references those cells?
 
Upvote 0
Best way to find out is to try. It really depends on the other data.
 
Upvote 0

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

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