ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How can I prefill a text field with leading 0s? (https://www.excelbanter.com/excel-worksheet-functions/73753-how-can-i-prefill-text-field-leading-0s.html)

Sweetetc

How can I prefill a text field with leading 0s?
 
I have a list on Text data
ie 1, 14, 203, etc
I want them all to be 6 charcters long.
ie 000001, 000014, 000203, etc.
I can concatenate but the I would manually need to remove extra 0's Any
suggestions

--
Thanks
ETC

Bob Phillips

How can I prefill a text field with leading 0s?
 
Set the format to 000000 (FormatCellsCustom)

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Sweetetc" wrote in message
...
I have a list on Text data
ie 1, 14, 203, etc
I want them all to be 6 charcters long.
ie 000001, 000014, 000203, etc.
I can concatenate but the I would manually need to remove extra 0's Any
suggestions

--
Thanks
ETC




Duke Carey

How can I prefill a text field with leading 0s?
 
If it is for display purposes, you can format (numbers, not text) using a
custom format of "000000"

If you need the values to 6 characters you can use for numeric values:
=text(number, "000000")

For text values:
=rept("0",6-len(text value))&text value


"Sweetetc" wrote:

I have a list on Text data
ie 1, 14, 203, etc
I want them all to be 6 charcters long.
ie 000001, 000014, 000203, etc.
I can concatenate but the I would manually need to remove extra 0's Any
suggestions

--
Thanks
ETC


Gary''s Student

How can I prefill a text field with leading 0s?
 
Format Cells... Number Custom and enter 000000
--
Gary's Student


"Sweetetc" wrote:

I have a list on Text data
ie 1, 14, 203, etc
I want them all to be 6 charcters long.
ie 000001, 000014, 000203, etc.
I can concatenate but the I would manually need to remove extra 0's Any
suggestions

--
Thanks
ETC


Sweetetc

How can I prefill a text field with leading 0s?
 
Duke

Thanks the TXT seemed to do the trick. I could not get the REPT to work
correctly
--
Thanks
ETC


"Duke Carey" wrote:

If it is for display purposes, you can format (numbers, not text) using a
custom format of "000000"

If you need the values to 6 characters you can use for numeric values:
=text(number, "000000")

For text values:
=rept("0",6-len(text value))&text value


"Sweetetc" wrote:

I have a list on Text data
ie 1, 14, 203, etc
I want them all to be 6 charcters long.
ie 000001, 000014, 000203, etc.
I can concatenate but the I would manually need to remove extra 0's Any
suggestions

--
Thanks
ETC



All times are GMT +1. The time now is 12:33 AM.

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