Changing A1-1-1 to A01-01-01 so on and so on

jamobe

New Member
Joined
Dec 23, 2014
Messages
36
Office Version
  1. 365
Platform
  1. Windows
Hello

I've got a spreadsheet and I've entered many cells with data in this format A1-1-1, A10-2-10, B11-11-2 etc etc.

These are locations on shelves so A1-1-1 to A1-1-12 represents one shelf, my problem is that when I sort the column it ends up like this.

A1-1-1
A1-1-10
A1-1-11
A1-1-12
A2-1-2
.
.
A2-1-9


Is there a formula or some kind of format I can use so I can put a zero at the beginning of the single numbers? Also I would prefer the format to be A1-1-1 but I just need Excel to know that a 1 is a 01 and not 10.

Any help would be much appreciated :)
 
Like this :

Book7
AB
1A1-1A01-01
Sheet1
Cell Formulas
RangeFormula
B1B1=SUBSTITUTE(SUBSTITUTE(IF(MID(A1,3,1)="-",REPLACE(A1,2,0,0),A1),"-","-0"),"00","0")
 
Upvote 0

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Like this :

Book7
AB
1A1-1A01-01
Sheet1
Cell Formulas
RangeFormula
B1B1=SUBSTITUTE(SUBSTITUTE(IF(MID(A1,3,1)="-",REPLACE(A1,2,0,0),A1),"-","-0"),"00","0")
Hello that works only problem im running to now that once i get to a1-10 it formats it to A01-010. And i will like to keep it to 2 digits all the way down . And i will end my numbers at a01-99
 
Upvote 0
Im not good At all with excel . Will this solution work even if my format is shorter . ? A1-1
If not what do i remove from solution
Give this formula a try...
Excel Formula:
=LEFT(A1)&TEXT(MID(A1,2,2-(FIND("-",A1)=3)),"00-")&TEXT(MID(A1,FIND("-",A1)+1,9),"-00")
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,687
Members
449,117
Latest member
Aaagu

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