New Excel Forum

This forum has been moved to TeachExcel.com

Ask all future questions in the New Excel Forum.

ExcelKey

how to use formula to change 8 digit to 10 digit

Formulas, Functions, Formatting, Charts, Data Analysis, etc.

how to use formula to change 8 digit to 10 digit

Postby sewfoong » Thu Dec 15, 2011 9:20 pm

I have a groud of 400 8 digit number , but i need to change it into 10 digit number (like 12345678 become 0012345678) start with 00, how can i use formula to do it? so i no need to manualy change it 400 time. thanks.
  • 0

sewfoong
Rookie
 
Posts: 1
Joined: Dec 15, 2011
Reputation: 0

Re: how to use formula to change 8 digit to 10 digit

Postby Don » Thu Dec 15, 2011 10:03 pm

Hi and welcome to the forum!

This requires a simple concatenation. Assuming your number is in cell A1, use a formula like this:

Code: Select all
="00"&A1


hope this helps :)
  • 0

Don
Moderator
 
Posts: 733
Joined: Dec 4, 2011
Reputation: 2
Excel Version: 2010

Re: how to use formula to change 8 digit to 10 digit

Postby Sisyphus » Sat Dec 17, 2011 5:26 am

Hi,
I would change the number format for the cell:
From the Toolbar: Format/Cells or Right-click/Format Cells, select the Numbers Tab.
Select "Custom" and enter 10 zeros in the "Type" field, just like this: 0000000000
After formatting one cell in this manner you can paint the format to other cells using the Paint brush. The format will also be available for selection, if you wish to format individual cells.

Cells such formatted will show all numbers with at least 10 digits, even if they had fewer than 8 digits before. You will see this format on the worksheet and in print, when you print the worksheet. However, the value in the formatted cell isn't changed. In Excel you can't have numbers with leading zeros. If you need to present a number in such a format you must change it to a text format. It will then cease to be a number, meaning, you can't use it for calculations any more.

Don's solution is the best if you already have a string (text) and need to add 2 zeros in front. It will also work if you have an alphanumeric number or even a string without any numbers. But if you have a real number to start out with you can convert it using this formula:
Code: Select all
=TEXT(A1, "0000000000")

If A1 contains a number - any numeric value - it will be written with 10 digits, zeros leading as required, fractions disregarded. If it contains text the formula will return whatever it found, unchanged. Use Edit / Paste Special [Values] to convert either Don's or the above formula to the final string that your probably need in your worksheet.
I hope this helps. :D
  • 0

Have a great day! :D

Sisyphus
I do this for "honour and country" - much less of the latter, actually.
If I helped you, award points, plenty of them.
If I bored you, deduct points for being too long-winded. (I know, :lol)
Sisyphus
Former Moderator
 
Posts: 4454
Joined: Dec 7, 2011
Location: Shanghai
Reputation: 203
Excel Version: 2010


Return to General Excel Questions

Who is online

Users browsing this forum: No registered users and 249 guests