![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Posts: 54
|
Hallo,
I have set of number say from A1 to A10 say 23 , 343 , 45345334 , 4353453 etc I need a formula that will make all these number to be 10 digits be adding zeros to the front of the number ie 0000000023 , 0000000343 , 0045345334 etc I think i can do it but doing an if statment ie if len(a1)=1, +"000000000"&a1 , ..... but that seems to be a long way around - does anyone know if there is a quicker easier way of doing this Thanks a lot Jonty |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Apr 2002
Posts: 80
|
If I understand your question right ......
You can select the column or cells that require the 10 digits. Right click and select format cells. Select the Number tab and select custom in category list insert 0 ten times (if you want 10 digits ) ......... select ok hope this helps ........ |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Mar 2002
Posts: 54
|
thanks a lot -
the simple things are often the best !!!! |
|
|
|
|
|
#4 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
Quote:
=RIGHT(REPT("0",10-LEN(A1))&A1,10) |
|
|
|
|
|
|
#5 | |
|
Board Regular
Join Date: Feb 2002
Posts: 202
|
Quote:
your LEN idea intrigued me, so just for fun: =VLOOKUP(LEN(A1),{1,"000000000";2,"00000000";3,"0000000";4,"000000";5,"00000";6,"0000";7,"000";8,"00";9,"0"},2)&A1 |
|
|
|
|
|
|
#6 | ||
|
Board Regular
Join Date: Feb 2002
Posts: 202
|
Quote:
|
||
|
|
|
|
|
#7 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
Quote:
=RIGHT("0000000000"&A1,10) [ This Message was edited by: Mark W. on 2002-04-16 07:47 ] |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|