Leading Zeros without the ' ?

capnqwest

New Member
Joined
Sep 8, 2003
Messages
32
I have a huge column with single digits that my database batch loader requires there to be two digits in this field. I used a formula to append a leading zero but this just appends a ' (like '02) that makes the database auto loader barf all over itself.

So i tried to convert these "textnumbers' to just plain numbers but then it strips out the leading zero. Is it possible to do such a simple thing?
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Hi captain,

Prefixing an apostrophe simply tells Excel that the value being entered is text, not a number, so Excel treats it as such. Excel knows to then ignore the apostrophe for its own operations, but perhaps your database batch loader is not aware of this Excel feature.

You can enter the numbers as text without introducing the apostrophe by formatting the cells as text before entering the data using Format > Cells > Text.

Keep Excelling.

Damon
 
Upvote 0
Hello there,

If it was for the look, you could use:
Format
Cells
Number
Custom
Type in 00

This way any single number will be preceeded by a leading zero but that just formatting, your value still be 9 or 6.

After that save a copy of your workbook as a text file or csv file. And try importing this way.

If this doesn't work then double check what type of value exactly the database is regarding this column. See if there is any constraint on this column of a data or a mask or something that may prevent the importing.

If a leading zero is required, I think your column must be text or if the previous fail, try may be using a decimal 0.9 and then after import do a query to locate your numbers ,multiply all value by 10 or if text replace . by ""


Not sure this will work but you can try
 
Upvote 0

Forum statistics

Threads
1,214,944
Messages
6,122,387
Members
449,080
Latest member
Armadillos

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