+ Reply to Thread
Results 1 to 11 of 11

How to put 0000 zeros in front of numbers

  1. #1
    Forum Contributor
    Join Date
    09-03-2008
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2021
    Posts
    351

    How to put 0000 zeros in front of numbers

    Hi I just want to know how I can do the following.

    I am importing a txt file into excel, on my first column I have numbers

    12
    30
    50
    13
    99
    103
    106

    So I want to know how can it be done, that when I import this it will put 4 (0000) in front of the two numbers and 3(000) in front of the three numbers by itself

    It should look like this

    000012
    000030

    000103
    000106

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

    Re: How to put 0000 zeros in front of numbers

    In A1 Cell

    103

    In B1 Cell

    =IF(A1="","",REPT("0",6-LEN(TRIM(A1)))&A1)

    Drag it down...


    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

  3. #3
    Forum Contributor
    Join Date
    09-03-2008
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2021
    Posts
    351

    Re: How to put 0000 zeros in front of numbers

    Sixthsense

    Thank You, but I am importing 3 diffrent files (3 working sheets), and then put them in one new sheet.

    Here are two files, one is just how I have inport them (test.xlsx), and then one (Tapes....) of how it looks after I have worked on them.

    It is on the All that I need it to show the 000/0000, and I am tring not to add a extra column as I have to sent this to other people.
    Attached Files Attached Files

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

    Re: How to put 0000 zeros in front of numbers

    You can finish this task easily without complicating it with import process.

    Just import all the data from all your files and use a helper column to apply the suggested formula and copy paste the formula result as values in the source. Delete the helper column.

  5. #5
    Forum Contributor
    Join Date
    10-30-2013
    Location
    Melbourne
    MS-Off Ver
    Excel 2013
    Posts
    173

    Re: How to put 0000 zeros in front of numbers

    OR
    Just leave it and use custom formatting...
    Custom fmt 000000.jpg

  6. #6
    Forum Contributor
    Join Date
    09-03-2008
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2021
    Posts
    351

    Re: How to put 0000 zeros in front of numbers

    Sixthsense

    Thank you, will do it, but I have to hide the extra column, if I dlete it it takes out all the info in one column, but it is working when I hide it.

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

    Re: How to put 0000 zeros in front of numbers

    As suggested by coolblue the formula can be simplified as

    =TEXT(A1,REPT(0,6))

  8. #8
    Forum Contributor
    Join Date
    10-30-2013
    Location
    Melbourne
    MS-Off Ver
    Excel 2013
    Posts
    173

    Re: How to put 0000 zeros in front of numbers

    Quote Originally Posted by :) Sixthsense :) View Post
    As suggested by coolblue the formula can be simplified as

    =TEXT(A1,REPT(0,6))
    You missunderstand my post. Check the image attached there.
    There is no need to use any formulas, nor mess arround cutting and pasting if the objective is for the numbers to just look like this. It cN be done very simply with custom formatting as shown in the image.

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

    Re: How to put 0000 zeros in front of numbers

    Quote Originally Posted by coolblue View Post
    You missunderstand my post
    No not at all

    Formatting a cell will change the View of the Data but it will not do any change with the actual data.

    After formatting check it in formula bar the actual text will remains same.

    So it is better to convert it as text with the help of formula

  10. #10
    Forum Contributor
    Join Date
    10-30-2013
    Location
    Melbourne
    MS-Off Ver
    Excel 2013
    Posts
    173

    Re: How to put 0000 zeros in front of numbers

    Quote Originally Posted by hendrikbez View Post
    ....
    It should look like this

    000012
    000030

    000103
    000106


    As I said, if it only needs to "look" that way then there is no need to change the data.
    Last edited by coolblue; 05-20-2014 at 04:31 AM.

  11. #11
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: How to put 0000 zeros in front of numbers

    Can you integrate this to do it..?

    Please Login or Register  to view this content.
    Last edited by apo; 05-20-2014 at 04:27 AM. Reason: Changed it so the array values were from Column A only..

+ 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. removing zeros at front of numbers
    By uglyduck in forum Excel General
    Replies: 2
    Last Post: 04-28-2010, 06:25 AM
  2. zeros in front of numbers in cell
    By Nennie in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 05-07-2009, 03:21 PM
  3. zeros at the front of numbers
    By fretwizard in forum Excel General
    Replies: 2
    Last Post: 11-06-2008, 08:19 AM
  4. Replies: 2
    Last Post: 06-30-2006, 10:25 AM
  5. [SOLVED] How do I keep the zeros in front of numbers when i split a cell
    By tom in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-10-2005, 11:05 PM

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