Add 0 to a bunch of columns

I have an Excel spreadsheet I need to add 0 in front of numbers currently in over 2000 cells
Any suggestions are appreciated.

Thanks
ManieyaK_Citrix Systems / Network AdminAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ProfessorJimJamCommented:
Just put this formula to the adjacent cell

Assuming your data is in column a starts with second row then put the below formula in B2 and then copy down

="0"&A2
0
aikimarkCommented:
Are the columns formatted as text?
The simplest way would be to use an adjacent (or new) column with a formula that prepends the "0" characte
Example:
="0"&A1

Open in new window

Copy/paste special (Values)  the new/formula column and then delete the original column
0
Wayne Taylor (webtubbs)Commented:
Is this for display purposes? If not, a number starting with a zero will need to be entered as text.

To display a zero in front, you can sue Number Formatting, with this format - "0"#
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

ProfessorJimJamCommented:
or if you want to change all of the cells at once, then run the below code from a module

Sub test()

Dim MyRange As Range
Set MyRange = ActiveSheet.UsedRange
Dim c
For Each c In MyRange
    If IsNumeric(c.Value) Then
        c.NumberFormat = "@"
        c.Value = 0 & c.Value
    End If
Next c

End Sub
 

Open in new window

0
Roy CoxGroup Finance ManagerCommented:
You can use a Custom Number Format

Select the cells
Right click and choose Format cells
Then click Custom
In the Type box enter 0000

You can adjust the number of zeros to suit your requirements. This means that the numbers will still be numbers and can be used in calculations but will display leading zeros.
0
tomfarrarCommented:
If the number of zeroes you need to add is variable, and the total length of the field is a fixed number, you may need this formula

=REPT(0,5-LEN(B3))&B3

In this case, the total length of the field is five characters.  See attached workbook example
EE.xlsx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ManieyaK_Citrix Systems / Network AdminAuthor Commented:
This is a spreadsheet which has all of our Inventory we are currently migrating from Retail Support Services RSS to QuickBooks.  Need to append 0 to make all numbers contain 8 charters.
0
ProfessorJimJamCommented:
Sub test()

Dim MyRange As Range
Set MyRange = ActiveSheet.UsedRange
Dim c
For Each c In MyRange
    If IsNumeric(c.Value) Then
        c.NumberFormat = "00000000"
        c.Value = 0 & c.Value
    End If
Next c

End Sub
0
tomfarrarCommented:
Did you look at my comment?
0
tomfarrarCommented:
Change the 5 t0 8 and you should have your answer.
0
ManieyaK_Citrix Systems / Network AdminAuthor Commented:
Thanks for the help with this,
Roy Cox when i do what you suggested Format is greyed out

tomfarrar I have not tried what you suggested I will attempt this over the next couple of days & post back.
0
Roy CoxGroup Finance ManagerCommented:
Is the sheet protected?
0
tomfarrarCommented:
Please let me know.   I have used this formula many times to add zeroes to the front of fields where the existing data  has variable lengths.   - Tom
0
Martin LissOlder than dirtCommented:
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
0
ProfessorJimJamCommented:
I believe that what the OP has asked was provided to him my answer 4096971 answers the exact question
0
aikimarkCommented:
4096971 is not a comment in this thread
0
ProfessorJimJamCommented:
thanks aikimark for pointing the mistake, I actually meant the comment Id 40969741
0
tomfarrarCommented:
My two comments should work also:

=REPT(0,5-LEN(B3))&B3

Change the 5 t0 8 and you should have your answer.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows 7

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.