ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Did not see any reply from yesterday. Need data formatting help (https://www.excelbanter.com/excel-worksheet-functions/31314-did-not-see-any-reply-yesterday-need-data-formatting-help.html)

TechGuyatwork

Did not see any reply from yesterday. Need data formatting help
 
Ok I have data in excel that looks like this:

2345
23667867
12345678
8564
3557
The data needs to be formatted to look like this
00002345
23667867
12345678
00008564
00003557
How do I add the zero to eacfh of the fields?
Does this entail scripting of some sort?
Please reply!!! ASAP!!!

Ron de Bruin

Hi TechGuyatwork

Format the cells like this

Select them
Ctrl-1
Custom, use 00000000

--
Regards Ron de Bruin
http://www.rondebruin.nl


"TechGuyatwork" wrote in message
...
Ok I have data in excel that looks like this:

2345
23667867
12345678
8564
3557
The data needs to be formatted to look like this
00002345
23667867
12345678
00008564
00003557
How do I add the zero to eacfh of the fields?
Does this entail scripting of some sort?
Please reply!!! ASAP!!!




Ron Coderre

Try this:

FormatCellsNumber
Category: Custon
Type: 00000000
Click [OK]

Note: that won't actuall prepend zeros to the the numbers. It will just
display zeros where needed.

Does that help?
--
Regards,
Ron

Alex

Hello

Here is a quick fix with a caveat...

Suppose data start in cell A1 and goes down column 1...type in cell B1...

=IF(LEN(A1)<8,"0000"&A1,A1)

And then drag this formula down.

Caveats...

(1)In your example I assume you either have data of 4 digits or 8 digits in
length.

In the formula, the first part assesses whether the data is less then 8
digits. If so it adds the 0000, otherwise the data remains as it is.

(2) By adding "0000" you are adding a string to the data and so the values
produced are no longer of number format. If you try to type 00001234 in Excel
then you just get 1234 as a number format. To get around this I have made the
data into a string format. You will notice this as those values will be
aligned leff in the cell but others that have not had 0000 added will be
aligned right. The result of this is that it may affect any calculations you
may want to do using the data. Hence this is a quick and dirty fix...for
aesthetics only...

Alex

"TechGuyatwork" wrote:

Ok I have data in excel that looks like this:

2345
23667867
12345678
8564
3557
The data needs to be formatted to look like this
00002345
23667867
12345678
00008564
00003557
How do I add the zero to eacfh of the fields?
Does this entail scripting of some sort?
Please reply!!! ASAP!!!



All times are GMT +1. The time now is 11:17 AM.

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