+ Reply to Thread
Results 1 to 2 of 2

Adding 0s in front of text to certain length

  1. #1
    Registered User
    Join Date
    04-13-2010
    Location
    Taiwan
    MS-Off Ver
    Excel 2007
    Posts
    25

    Adding 0s in front of text to certain length

    I have a column of numbers the supposed to be 8 digits. However, the cell format was in number instead of text, some number started with zeros got truncated. For example

    80233571
    20723217
    1220138
    32147
    1753029
    235789
    90527517

    How can I get the numbers back to 8 digits?

    80233571
    20723217
    01220138
    00032147
    01753029
    00235789
    90527517
    Last edited by bruce71101; 09-28-2011 at 05:53 AM.

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Adding 0s in front of text to certain length

    Select the column, right click on it somewhere, select the "Format cells" option, go to the "Number" tab, select "Custom" format from the list and overwrite the bit that says "General" with 8 zeros.

    That will display all of your numbers with leading zeros.

    If you actually want to add the zeros to the front and make them text again then insert a column next to the one you've got and, on your first data row put the formula =TEXT(A2,"00000000") and copy all the way down the column (I'm assuming that your data is in column A, starting at row 2.

    Once you've copied down then select and copy that entire column of formula, then select the top cell in your existing data and Paste special and pick "Values", this will overwrite your original data with the results of the formula and you can now delete the formula column you added.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1