![]() |
![]() |
|
|||||||
| 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 |
|
New Member
Join Date: Feb 2002
Posts: 27
|
I have a column of cells, about 6000 in all, that contain text based numbers, no formulas. The length of the number should contain six digits. The problem is that about half of these cells contain less than six digits.
I need to add zero's to the number to act as place holder's in those cells that do not contain all six digits. Is there a way to add the zero to these cells without performing it manually? For example: B2750 has the number '98176', but I need it to be '098176'. B4821 has the number '4498', but I need it to be '004498'. And so on until I have single digit numbers. Can anyone help me with this? Thank you, Jason |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Allentown, PA
Posts: 2,512
|
Format-Cells-Custom
000000
__________________
~Anne Troy |
|
|
|
|
|
#3 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
I understand that you have text representation of numbers (e.g., "98176") that you want to be fixed-length (6 chars).
For values in column A enter the formula... =REPT(0,6-LEN(A1))&A1 ...and Fill down as needed. Use Copy/Paste Special Values to preserve the resultant values. |
|
|
|
|
|
#4 |
|
New Member
Join Date: Feb 2002
Posts: 27
|
Thanks to both of you for your responses.
I tried the first suggestion and it seemed to have worked. I'm glad to know it was something so simple. You guys are going to turn me into a pro, yet! Thanks again, Jason |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|