ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   how to create leading zeros on variable length numbers (https://www.excelbanter.com/excel-discussion-misc-queries/51934-how-create-leading-zeros-variable-length-numbers.html)

MVPitts

how to create leading zeros on variable length numbers
 
I have a column of variable length numbers/text (6-12 characters). I need to
place leading zeros in each of the cells to create a standard length of 15
characters. What's the easiest way to do this?

Gary''s Student

how to create leading zeros on variable length numbers
 
sleect cells or column then pull-down:

Format Cells... Number Custom and enter 000000000000000
in place of general
--
Gary's Student


"MVPitts" wrote:

I have a column of variable length numbers/text (6-12 characters). I need to
place leading zeros in each of the cells to create a standard length of 15
characters. What's the easiest way to do this?


FxM

how to create leading zeros on variable length numbers
 
MVPitts wrote:
I have a column of variable length numbers/text (6-12 characters). I need to
place leading zeros in each of the cells to create a standard length of 15
characters. What's the easiest way to do this?


Hi MVPitts,

Try :
=right(REPT("0",15) & "text" , 15)

@+
FxM

Niek Otten

how to create leading zeros on variable length numbers
 
=IF(ISTEXT(A1),REPT("0",15-LEN(A1))&A1,TEXT(A1,"000000000000000"))

--
Kind regards,

Niek Otten

"MVPitts" wrote in message
...
I have a column of variable length numbers/text (6-12 characters). I need
to
place leading zeros in each of the cells to create a standard length of 15
characters. What's the easiest way to do this?




Niek Otten

how to create leading zeros on variable length numbers
 
Which, indeed, can be simplified to

=REPT("0",15-LEN(A1))&A1

--
Kind regards,

Niek Otten

"Niek Otten" wrote in message
...
=IF(ISTEXT(A1),REPT("0",15-LEN(A1))&A1,TEXT(A1,"000000000000000"))

--
Kind regards,

Niek Otten

"MVPitts" wrote in message
...
I have a column of variable length numbers/text (6-12 characters). I need
to
place leading zeros in each of the cells to create a standard length of
15
characters. What's the easiest way to do this?







All times are GMT +1. The time now is 02:52 PM.

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