+ Reply to Thread
Results 1 to 13 of 13

Add Trailing Zeros

  1. #1
    Registered User
    Join Date
    09-12-2012
    Location
    Fort Worth, TX
    MS-Off Ver
    Excel 2007
    Posts
    30

    Add Trailing Zeros

    I need to add 4 trailing zeros to a zipcode when the zipcode contains only 5 characters.

    Data (includes null rows):
    752045513
    71862
    770243928
    75204

    752054524

    Expected Output (null rows should be left null):
    752045513
    718620000
    770243928
    752040000

    752054524


    Your assistance is appreciated.

  2. #2
    Registered User
    Join Date
    09-12-2012
    Location
    Fort Worth, TX
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Add Trailing Zeros

    I tried =TEXT(B3, "000000000") but it is adding leading zeros.... and putting zeros in the null rows.

  3. #3
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Add Trailing Zeros

    I believe that the number of digits should be 9 so try the below formula.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  4. #4
    Registered User
    Join Date
    09-12-2012
    Location
    Fort Worth, TX
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Add Trailing Zeros

    It didn't work for the rows with a 5 character zip........... other rows look fine.

    Example: 75204 shows as 75204 instead of 752040000

  5. #5
    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
    52,933

    Re: Add Trailing Zeros

    if your data is in A1, use this...

    =IF(A1="","",A1&REPT("0",9-LEN(A1)))
    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

  6. #6
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Add Trailing Zeros

    Oops mis interpreted it as leading zeroes.

    Try this...

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  7. #7
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: Add Trailing Zeros

    or with Value( )

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  8. #8
    Registered User
    Join Date
    09-12-2012
    Location
    Fort Worth, TX
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Add Trailing Zeros

    the formula by FDibbins and vlady also didn't add the trailing four zeros to the zipcode, but thank you for your efforts!

    Sixthsense new formula works perfectly, thank you!!!!

  9. #9
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Add Trailing Zeros

    We require the sample of the data to find the root cause of this problem. Can you please share that cell info in a dummy file as an attachment in continuation of this thread?

  10. #10
    Registered User
    Join Date
    09-12-2012
    Location
    Fort Worth, TX
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Add Trailing Zeros

    sixth sense, I updated my previous comment, your formula works perfectly, thank you!!!

  11. #11
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: Add Trailing Zeros

    hmmm. so there are leading/trailing spaces... the trim() did it...

  12. #12
    Registered User
    Join Date
    09-12-2012
    Location
    Fort Worth, TX
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Add Trailing Zeros

    ahhhh, ok thank you vlady!!!!!

  13. #13
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Add Trailing Zeros

    Thanks for the feedback. Glad your problem is solved.

    The solutions we offered are just based on assumption and sometimes we will be lucky to see it working and some time it may not…

+ 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