Trouble with identifying the Nth "-"

dark_rug

New Member
Joined
May 20, 2014
Messages
18
Hey all,

I'm translating a string characters:

xzyxzyzxyy 8-22-60-5W6 zxyzxyyxzy
zxyxzy 10-21-1-6 yxzyzyyxyzxyyzyxy
yzxyxzyyxzyxzyxyzyx 6-20-111-5 yzx

to:

08-22-060-05W6
10-21-001-06W6
06-20-111-05W6

And I was thinking of searching for the Nth "-" by using a FIND("-",A1,FIND("-",A1)+0) tied to a TEXT(value, format) inside a MID command inside a CONCATENATE to string it all together.

I really don't have any idea how to do this though.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
=concatenate(text(left(mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)),(search("-",mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2))))-1),"00"),"-",text(mid(mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)),search("-",mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)))+1,search("-",mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)),search("-",mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)))+1)-search("-",mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)))-1),"00"),"-",text(substitute(mid(mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)),search("-",mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)),search("-",mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)))+1),search("-",mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)),search("-",mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)),search("-",mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)))+1)+1)-search("-",mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)),search("-",mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)))+1)),"-",""),"000"),"-",text(mid(mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)),search("-",mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)),search("-",mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)),search("-",mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)))+1)+1)+1,10),"00w6")) try if u can make something from it.
 
Upvote 0
=concatenate(text(left(mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)),(search("-",mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2))))-1),"00"),"-",text(mid(mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)),search("-",mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)))+1,search("-",mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)),search("-",mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)))+1)-search("-",mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)))-1),"00"),"-",text(substitute(mid(mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)),search("-",mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)),search("-",mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)))+1),search("-",mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)),search("-",mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)),search("-",mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)))+1)+1)-search("-",mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)),search("-",mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)))+1)),"-",""),"000"),"-",text(mid(mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)),search("-",mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)),search("-",mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)),search("-",mid(a2,search(" ",a2),search(" ",a2,search(" ",a2)+1)-search(" ",a2)))+1)+1)+1,10),"00w6")) try if u can make something from it.

Dude, wow. I had finally gotten it and you show up haha.
Mine's a little prettier.

=CONCATENATE(TEXT(MID(F9,FIND("-",F9,1)-2,2),"00"),"-",TEXT(MID(F9,FIND("-",F9,FIND("-",F9))+1,FIND("-",F9,FIND("-",F9)+1)-(FIND("-",F9,FIND("-",F9))+1)),"00"),"-",TEXT(MID(F9,1+FIND("-",F9,FIND("-",F9)+1),FIND("-",F9,FIND("-",F9,FIND("-",F9)+1)+1)-FIND("-",F9,FIND("-",F9)+1)-1),"000"),"-",TEXT(MID(F9,FIND("-",F9,FIND("-",F9,FIND("-",F9)+1)+1)+1,1),"00"),"W6")
 
Upvote 0

Forum statistics

Threads
1,223,230
Messages
6,170,883
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