Solved

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

Posted on 2013-02-02
5
158 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

What is a Form List Box? (skip if you know this) The forms List Box is the alternative to the ActiveX list box. If you are using excel 2007, you first make sure you have a developer tab (click the Orb)->"Excel Options"->Popular->"Show Developer tab…
Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

760 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

20 Experts available now in Live!

Get 1:1 Help Now