ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Change #'s to Text macro (https://www.excelbanter.com/excel-discussion-misc-queries/131342-change-s-text-macro.html)

MikeD1224

Change #'s to Text macro
 
I need to be able to do the following:

I have a list of store #'s in column D (ex below). I need to format the
column as text and for any number that is less than 10, I need it to be
changed so that it has a leading 0 that will stay when saved as a CSV file.

I'm stuck on this so any help would be great. Thanks

Current How I want it

1 01
2 02
3 03
4 04
5 05
6 06
7 07
8 08
9 09
10 10

Toppers

Change #'s to Text macro
 
in B1:

=TEXT(A1,"00")

where A1=1 etc

HTH

"MikeD1224" wrote:

I need to be able to do the following:

I have a list of store #'s in column D (ex below). I need to format the
column as text and for any number that is less than 10, I need it to be
changed so that it has a leading 0 that will stay when saved as a CSV file.

I'm stuck on this so any help would be great. Thanks

Current How I want it

1 01
2 02
3 03
4 04
5 05
6 06
7 07
8 08
9 09
10 10


Nick Hodge

Change #'s to Text macro
 
Mike

Pre-formatting the data as text will retain the leading zero's in the csv
file. Try opening it in Notepad an you'll see them.

It's the re-opening in Excel that strips the zeroes. About the only way
around this is to remove the csv extension, or save it as .txt and use
fileopen in Excel and then use the text import wizard (step 3) to mark the
column as text and all will be well

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"MikeD1224" wrote in message
...
I need to be able to do the following:

I have a list of store #'s in column D (ex below). I need to format the
column as text and for any number that is less than 10, I need it to be
changed so that it has a leading 0 that will stay when saved as a CSV
file.

I'm stuck on this so any help would be great. Thanks

Current How I want it

1 01
2 02
3 03
4 04
5 05
6 06
7 07
8 08
9 09
10 10



Dave Peterson

Change #'s to Text macro
 
Select the column
format|Cells|Number tab|custom category
type:
00

And save as your .csv file.

Then use Notepad to verify that it worked--don't open the .csv file in excel.
Excel will strip the leading 0's in your .csv file when it opens the file.

MikeD1224 wrote:

I need to be able to do the following:

I have a list of store #'s in column D (ex below). I need to format the
column as text and for any number that is less than 10, I need it to be
changed so that it has a leading 0 that will stay when saved as a CSV file.

I'm stuck on this so any help would be great. Thanks

Current How I want it

1 01
2 02
3 03
4 04
5 05
6 06
7 07
8 08
9 09
10 10


--

Dave Peterson


All times are GMT +1. The time now is 12:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com