Changing the length of a number

CesarAustin

Board Regular
Joined
Aug 21, 2004
Messages
147
Hope someone can help me, I have a table with one column with numbers from 1~999 I need to do some kind of update quarry or something to change the 1 and 2 digits to 3 digits… example: number 1,2,3 changed to 001, 002, 003 etc.. I have no idea how to do that without exporting the information from access to excel then manually changing the numbers in excel. Any help would be great.. Thanks all
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Hi

Try something along the lines of (SQL query):

Update myTable
Set myField = left("000",3-len(myField)) & MyField

Assuming you want the resulting field length to be 3 chars - if you want 4 then change the "000" to "0000" and the 3 to 4 and you should be set.

HTH
Martin
 
Upvote 0
Thank you pritcham… I’m not that good in make SQLs to work… my table is called “Systems Location”…. In that table I have two columns… the 1st column (name: “FLOOR”) has letters… and in the 2nd columns (name: “Jack Num”) I have the numbers.. 1~999… I want to change the 2nd column (or add a 3rd, what ever is easier) and add the 1st column to the 2nd column.. Example.. A001, B002, C015, D100.. etc…
 
Upvote 0
Why not just format the number field as 000?

If you want to get A001, B002... etc you could use this expression in a query.

[FLOOR] & Format([Jack Num], "000")
 
Upvote 0

Forum statistics

Threads
1,214,818
Messages
6,121,725
Members
449,049
Latest member
MiguekHeka

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