Solved

How can I append a number to the beginning of a number -- and then drag it down.

Posted on 2013-02-02
5
168 Views
Last Modified: 2013-02-03
Hi

Have Excel Office 2007.  Windows 7.

I have a column of numbers (can be text or number format), like this:

2123
2121
3123

I want to add a "zero" to the beginning of each of those numbers, such

02123
02121
03123

What formula can I use to do this.

Rowby
0
Comment
Question by:Rowby Goren
5 Comments
 
LVL 16

Assisted Solution

by:terencino
terencino earned 250 total points
ID: 38847631
Try ="0"&B2 then drag it down
Add zero...Terry
0
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 125 total points
ID: 38847632
If you want the leading zero to be part of the value:

="0"&A2

If you want to simply alter the display, without changing the value, use a custom number format of 00000
0
 
LVL 16

Assisted Solution

by:terencino
terencino earned 250 total points
ID: 38847646
You could copy the formula column then paste special values it over the original column. Or you could add this little macro, it adds a leading apostrophe to the selected values so it will always be treated as text data type.

Sub AddZero()
Dim c As Range
For Each c In Selection
    c.Value = "'0" & c.Value
Next c
End Sub

Open in new window

0
 
LVL 7

Assisted Solution

by:karunamoorthy
karunamoorthy earned 125 total points
ID: 38848488
Suppose if you want like this,
A1       B1
1         00001
12         00012
123         00123
1234   01234


you can use this formula

=text(A1,"00000")

This appending zeros also work with alphabets also

Have a nice day!
0
 
LVL 9

Author Closing Comment

by:Rowby Goren
ID: 38849158
Thanks!   All your solutions worked, in different ways.

I went with the 000000 formatting in this situation.

Rowby
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Sparklines have been introduced with Excel 2010 and are a useful tool for creating small in-cell charts, used for example in dashboards. Excel 2010 offers three different types of Sparklines: Line, Column and Win/Loss. What it does not offer is a…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now