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_CSSPAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

ProfessorJimJamMicrosoft Excel ExpertCommented:
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
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
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"#
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

ProfessorJimJamMicrosoft Excel ExpertCommented:
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

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.
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

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_CSSPAuthor 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.
ProfessorJimJamMicrosoft Excel ExpertCommented:
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
tomfarrarCommented:
Did you look at my comment?
tomfarrarCommented:
Change the 5 t0 8 and you should have your answer.
ManieyaK_CSSPAuthor 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.
Roy CoxGroup Finance ManagerCommented:
Is the sheet protected?
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
Martin LissOlder than dirtCommented:
I've requested that this question be deleted for the following reason:

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

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

Change the 5 t0 8 and you should have your answer.
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.