How to parse data from a cell

santa12345

Board Regular
Joined
Dec 2, 2020
Messages
66
Office Version
  1. 365
Platform
  1. Windows
Hello.

What formula would I use to parse the following.

JC-RO-06-L367-E201-J166-MK5C40-M14XT

The number could and can be different, but the section I'm looking for the characters following the MK.
So in this example I would want the formula to return 5C40.

Another example:

JC-RO-06-L367-E201-J166-MK5C4011-M14XT
So in this example I would want the formula to return 5C4011

Bottom line - the text after the MK and before the - .

Thank you.... hopefully this makes sense.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Two questions...

1) Is it possible for the letters "MK" to appear in the text before the MK that you want?

2) Is the MK text that you want always located immediately before the last dash?
 
Upvote 0
this is awesome !!! works fantastic.....
i have another question....should i post a new thread ?

its in regards to ....
vba code.... how to open another worksheet...and then copy a tab from that file to the file holding the macro

file abc.xls having a macro to open def.xls...copy sheet1 from def.xls and paste it into sheet2 of abc.xls
 
Upvote 0
Hi Rick.

To answer your Two questions...

1) Is it possible for the letters "MK" to appear in the text before the MK that you want? NO..the text is always after the MK.

2) Is the MK text that you want always located immediately before the last dash? YES - that is correct.
 
Upvote 0
2) Is the MK text that you want always located immediately before the last dash? YES - that is correct.
In that case, this formula should also work...
Excel Formula:
=MID(TRIM(LEFT(RIGHT(SUBSTITUTE(A1,"-",REPT(" ",100)),200),100)),3,99)
 
Upvote 0
Always a good idea to provide enough sample to show any variety that might occur with your data. For instance, both your examples start with exactly "JC-RO-06-L367-E201-J166-MK"
and end with exactly "-M14XT" but I'm guessing that is not always the case?

If you have the LET function then another possibility might be
Excel Formula:
=LET(s,REPLACE(A1,1,FIND("-MK",A1)+2,""),LEFT(s,FIND("-",s)-1))
 
Upvote 0
i think i have everything working based on the great suggestions above. THANK YOU!
i have another cell (last one) that i need to populate

JC-RO-06-L603-E350-J253-MKX879-C04-IN-C06-OUT-M1.8

I need to extract the RO.... it will always be the 4th character...and will contain only 2 characters
thank you again.

 
Upvote 0

Forum statistics

Threads
1,214,947
Messages
6,122,413
Members
449,082
Latest member
tish101

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