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 [TABLE="width: 136"]
<tbody>[TR]
[TD]
102080704807W400

into this

[TABLE="width: 223"]
<tbody>[TR]
[TD]102/08-07-048-07W4/00

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


thanks,

Lorenzo
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
 
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
[TABLE="class: cms_table, width: 136"]
<tbody>[TR]
[TD]102080704807W400
[TABLE="class: cms_table, width: 223"]
<tbody>[TR]
[TD]102/08-07-048-07W4/00[/TD]
[/TR]
</tbody>[/TABLE]

[/TD]
[/TR]
</tbody>[/TABLE]
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

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