Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default how do I add a zero in front of a bunch of 4 digit numbers?

I have a spreadsheet with over 1000 CSI codes that are only 4 numbers. The 4
numbered CSI codes all need a Zero in front to make it a five digit code. Is
there an easy way to just globally add a zero to just these 4 digit codes?
Example:
Wrong codes How I want them to look
2515 02515
2351 02351
7524 07524

Just hoping there is a way to avoid having to go into each cell and add a
zero.
Thanks for your help
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default how do I add a zero in front of a bunch of 4 digit numbers?

FormatCellsCustom, and enter a value of 00000

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Jenilise" wrote in message
...
I have a spreadsheet with over 1000 CSI codes that are only 4 numbers. The
4
numbered CSI codes all need a Zero in front to make it a five digit code.
Is
there an easy way to just globally add a zero to just these 4 digit codes?
Example:
Wrong codes How I want them to look
2515 02515
2351 02351
7524 07524

Just hoping there is a way to avoid having to go into each cell and add a
zero.
Thanks for your help



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 87
Default how do I add a zero in front of a bunch of 4 digit numbers?

use =CONCATENATE("0",A2) in proper columns and copy it down , ofcourse you
need to change A2 to a desired column.
--
Best regards,
Edward


"Jenilise" wrote:

I have a spreadsheet with over 1000 CSI codes that are only 4 numbers. The 4
numbered CSI codes all need a Zero in front to make it a five digit code. Is
there an easy way to just globally add a zero to just these 4 digit codes?
Example:
Wrong codes How I want them to look
2515 02515
2351 02351
7524 07524

Just hoping there is a way to avoid having to go into each cell and add a
zero.
Thanks for your help

  #4   Report Post  
Posted to microsoft.public.excel.misc
Banned
 
Posts: 19
Default how do I add a zero in front of a bunch of 4 digit numbers?

Suppose you 4-digit number are in Column A, starting from row 1. You
could insert the following formula in cell B1 and drag to final row:
="0" & A1

This way your cells will actually have a leading zero. If you just
format the column, the leading zero is only visible in cell and not
actually inserted before your numbers. If you only want to view
leading zero, prefer Bob's suggestion, if you want to manipulate your
cells in other formulas and want them to have the leading zero, prefer
the above formula.

Best.

http://www.exciter.gr
Custom Excel Applications and Functions!


On Nov 3, 12:03 am, Jenilise
wrote:
I have a spreadsheet with over 1000 CSI codes that are only 4 numbers. The 4
numbered CSI codes all need a Zero in front to make it a five digit code. Is
there an easy way to just globally add a zero to just these 4 digit codes?
Example:
Wrong codes How I want them to look
2515 02515
2351 02351
7524 07524

Just hoping there is a way to avoid having to go into each cell and add a
zero.
Thanks for your help



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 168
Default how do I add a zero in front of a bunch of 4 digit numbers?

If your data is in column A, starting in A1, you could enter this
formula in B1

="'0"&A1

and fill down. But that would change your numbers to text.

Or you could format the column as text and use the formula ="0"&A1


HTH,
JP

On Nov 2, 6:03 pm, Jenilise
wrote:
I have a spreadsheet with over 1000 CSI codes that are only 4 numbers. The 4
numbered CSI codes all need a Zero in front to make it a five digit code. Is
there an easy way to just globally add a zero to just these 4 digit codes?
Example:
Wrong codes How I want them to look
2515 02515
2351 02351
7524 07524

Just hoping there is a way to avoid having to go into each cell and add a
zero.
Thanks for your help





  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 25
Default how do I add a zero in front of a bunch of 4 digit numbers?

Hi all.
For several lenghts of datas, try:
=REPT(0,5-LEN(A2)) & A2
Regards
Eliano


"Jenilise" wrote:

I have a spreadsheet with over 1000 CSI codes that are only 4 numbers. The 4
numbered CSI codes all need a Zero in front to make it a five digit code. Is
there an easy way to just globally add a zero to just these 4 digit codes?
Example:
Wrong codes How I want them to look
2515 02515
2351 02351
7524 07524

Just hoping there is a way to avoid having to go into each cell and add a
zero.
Thanks for your help

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 25
Default how do I add a zero in front of a bunch of 4 digit numbers?

Hi Jenilise.
For 1000 codes and over i believe is bettere a Vba code; try:

Public Sub prova()

Dim L As Long
Dim WB As Workbook
Dim SH As Worksheet
Dim Rng As Range, rCell As Range
Dim LRow As Long
Dim LV As Long

Set WB = ActiveWorkbook
Set SH = WB.Sheets("Foglio2")
LRow = Cells(Rows.Count, "A").End(xlUp).Row
Set Rng = SH.Range("A2:A" & LRow)
Rng.NumberFormat = "@"
LV = 5
For Each rCell In Rng.Cells
rCell.Select
If Len(rCell) < LV Then
L = Len(rCell)
For L = Len(rCell) To LV - 1
rCell = "0" & rCell
Next L
End If
Next rCell
End Sub

Regards
Eliano

"Jenilise" wrote:

I have a spreadsheet with over 1000 CSI codes that are only 4 numbers. The 4
numbered CSI codes all need a Zero in front to make it a five digit code. Is
there an easy way to just globally add a zero to just these 4 digit codes?
Example:
Wrong codes How I want them to look
2515 02515
2351 02351
7524 07524

Just hoping there is a way to avoid having to go into each cell and add a
zero.
Thanks for your help

  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default how do I add a zero in front of a bunch of 4 digit numbers?

Thank you so much Bob... worked perfect!

"Bob Phillips" wrote:

FormatCellsCustom, and enter a value of 00000

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Jenilise" wrote in message
...
I have a spreadsheet with over 1000 CSI codes that are only 4 numbers. The
4
numbered CSI codes all need a Zero in front to make it a five digit code.
Is
there an easy way to just globally add a zero to just these 4 digit codes?
Example:
Wrong codes How I want them to look
2515 02515
2351 02351
7524 07524

Just hoping there is a way to avoid having to go into each cell and add a
zero.
Thanks for your help




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Store numbers starting with zero as 2 digit numbers twisted1825 Excel Discussion (Misc queries) 8 January 11th 07 06:41 PM
How to generate a bunch of random numbers??? ddawg09 Excel Discussion (Misc queries) 6 March 13th 06 01:33 AM
what is the minimum numbers set for 4 digit numbers from 0000 to 9 Ambika Excel Discussion (Misc queries) 14 January 27th 06 10:50 PM
how can i get a cell to hold a zero in front of a digit ie. 01 or. Southern Belle Excel Discussion (Misc queries) 2 February 2nd 05 09:56 PM
16 DIGIT NUMBERS IN CELL WITHOUT LAST DIGIT BEING A ZERO jnkell Excel Worksheet Functions 2 December 18th 04 07:13 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"