ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Defined number of characters (https://www.excelbanter.com/excel-discussion-misc-queries/69052-defined-number-characters.html)

Carrie

Defined number of characters
 
I have a spreadsheet that has numerical values in cells of different lengths,
ie xxx, xxxxxx, etc. I need to make all the values 6 characters long by
adding or removing zeros at the beginning and therefore not altering the
value. I then want it to appear as text rather than number. Can anyone help

David Billigmeier

Defined number of characters
 
If your value was in A1:

=TEXT(A1,"000000")


--
Regards,
Dave


"Carrie" wrote:

I have a spreadsheet that has numerical values in cells of different lengths,
ie xxx, xxxxxx, etc. I need to make all the values 6 characters long by
adding or removing zeros at the beginning and therefore not altering the
value. I then want it to appear as text rather than number. Can anyone help


pinmaster

Defined number of characters
 
Try someting like:

=IF(LEN(A1)<=6,TEXT(A1,"000000"),TEXT(RIGHT(A1,6), "000000"))

HTH
JG

"Carrie" wrote:

I have a spreadsheet that has numerical values in cells of different lengths,
ie xxx, xxxxxx, etc. I need to make all the values 6 characters long by
adding or removing zeros at the beginning and therefore not altering the
value. I then want it to appear as text rather than number. Can anyone help


PCLIVE

Defined number of characters
 
One way:
=REPT(0,6-LEN(A1)) & A1

HTH,
Paul

"Carrie" wrote in message
...
I have a spreadsheet that has numerical values in cells of different
lengths,
ie xxx, xxxxxx, etc. I need to make all the values 6 characters long by
adding or removing zeros at the beginning and therefore not altering the
value. I then want it to appear as text rather than number. Can anyone
help





All times are GMT +1. The time now is 01:49 PM.

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