+ Reply to Thread
Results 1 to 6 of 6

Adding Zeros

  1. #1
    Registered User
    Join Date
    09-19-2014
    Location
    Richmond VA
    MS-Off Ver
    10
    Posts
    8

    Adding Zeros

    I have a list of number, various number of digits in each cell. is there a function that I can say "put preceding zeros totaling 20 characters" so each cells has 20 characters with my original number plus preceding zeros.

    thanks
    Tom

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Adding Zeros

    excel will only take 15 digits in a number, anything over that gets replaced with 0 anyway...
    123456789012345
    1234567890123450
    12345678901234500
    etc.
    Anything more than 15, you will need to enter using text format

    If you have numbers with less digits than that, you can apply custom formatting with the amount of 0's to indicate how many numbers you want shown.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    09-19-2014
    Location
    Richmond VA
    MS-Off Ver
    10
    Posts
    8

    Re: Adding Zeros

    Great, thanks for your help

    tom

  4. #4
    Registered User
    Join Date
    09-19-2014
    Location
    Richmond VA
    MS-Off Ver
    10
    Posts
    8

    Re: Adding Zeros

    I tried the custom format and it added the zeros in front of my number, but when I do the text to column (because I only need the last 4 digits) it does not see the cells as 15 digits each, it only see the original numbers. any ideas?

    tom

  5. #5
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Adding Zeros

    This number format will pad the number with zeros on the right of the number to fill the width of the column. If the column width is for 20 characters, then enough zeros will be added to fill the column. The wider you make the column the more zeros are added. This however does not change the actual number in the cell. It is strictly a visual thing.


    CUSTOM NUMBER FORMAT: 0#0*0

    A
    1
    1234567890123450000
    2
    1234567890123450000
    3
    1234567890123450000
    4
    1234567890123450000
    5
    1234567890123450000
    6
    1234567890123450000
    7
    1234567890123450000
    8
    1234567890123450000
    9
    1234567890123450000
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  6. #6
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Adding Zeros

    Add zeros with formula

    =TEXT(A1,"00000000000000000000")

    Row\Col
    A
    B
    1
    123456789012345 00000123456789012345
    2
    1234567890123450 00001234567890123450
    3
    12345678901234500 00012345678901234500
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Adding zeros
    By zloep in forum Excel General
    Replies: 2
    Last Post: 01-11-2013, 12:02 PM
  2. Adding lead zeros
    By lgreco291 in forum Excel General
    Replies: 1
    Last Post: 01-07-2013, 04:28 PM
  3. Adding zeros when not found
    By pat_johnson in forum Excel General
    Replies: 6
    Last Post: 01-03-2012, 01:49 PM
  4. [SOLVED] adding zeros to a cell
    By DD in forum Excel General
    Replies: 3
    Last Post: 04-29-2005, 03:06 PM
  5. Deleting or Adding Zeros
    By Raquel666 in forum Excel General
    Replies: 1
    Last Post: 02-25-2005, 08:06 AM

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