Excel Formatting Formula

lorenzoc

New Member
Joined
Feb 21, 2013
Messages
26
Good day everyone and thanks for the help,

how do I write a formula that will change these numbers

102080704807W400

into this

102/08-07-048-07W4/00

These are well unit numbers and
I have about 900 of them. The pattern of / and - are always the same.


thanks,

Lorenzo

<tbody>
</tbody>

<tbody>
</tbody>
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
theres gotta be a better way....

but if the ID number length is consistent you can try

=REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(A1,4,0,"/"),7,0,"-"),10,0,"-"),14,0,"-"),19,0,"/")
 
Upvote 0
lorenzoc,

Something like this?


Excel 2007
AB
1102080704807W400102/08-07-048-07W4/00
Sheet1
Cell Formulas
RangeFormula
B1=LEFT(A1,3)&"/"&MID(A1,4,2)&"-"&MID(A1,6,2)&"-"&MID(A1,8,3)&"-"&MID(A1,11,4)&"/"&MID(A1,15,2)
 
Last edited:
Upvote 0
102080704807W400
102/08-07-048-07W4/00

<tbody>
</tbody>


<tbody>
</tbody>
Assuming the number start in Cell A2
=MID(A2,1,3)&"/"&MID(A2,4,2)&"-"&MID(A2,7,2)&"-"&MID(A2,8,3)&"-"& MID(A2,11,4)&"/"&MID(A2,15,2)
 
Upvote 0
Assuming the values you are converting are always the same (12 digits, a letter, 3 more digits), then here is another formula to consider...

=TEXT(LEFT(A1,12),"000\/00-00-000-00")&MID(A1,13,1)&TEXT(RIGHT(A1,3),"0\/00")
 
Upvote 0
lorenzoc,

Thanks for the feedback.

Your are very welcome. Glad we could help.

And, come back anytime.
 
Upvote 0
Assuming the values you are converting are always the same (12 digits, a letter, 3 more digits), then here is another formula to consider...

=TEXT(LEFT(A1,12),"000\/00-00-000-00")&MID(A1,13,1)&TEXT(RIGHT(A1,3),"0\/00")
I mananged to reduce down from 5 total function calls to 4 total function calls...

=SUBSTITUTE(TEXT(REPLACE(A1,13,1,"."),"000\/00-00-000-00.0\/00"),".",MID(A1,13,1))

or alternately (still 4 total function calls)...

=REPLACE(TEXT(REPLACE(A1,13,1,"."),"000\/00-00-000-00.0\/00"),17,1,MID(A1,13,1))
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,222
Messages
6,129,586
Members
449,520
Latest member
TBFrieds

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