+ Reply to Thread
Results 1 to 13 of 13

excel deleting zeros - this is a huge problem :)

  1. #1
    Registered User
    Join Date
    09-22-2014
    Location
    europe
    MS-Off Ver
    microsoft office 2010
    Posts
    23

    excel deleting zeros - this is a huge problem :)

    Hi guys,

    I am importing data to excel from txt file. First I need to use "text to columns" option to get the data i need in separate columns, which works very good, however this option would delete all zeros infront of the number to number without zeros. e.g. 003845 to 3845.

    The problem I am facing here is I can not use custom format cell option, because i do not know how many zeors is infornt of each number (it is not point to compare txt file with excel file), besides the data i import and use it after "text to columns" option consists text as well, not only numbers.

    for an example:

    abcd
    3845
    asdasdasdasd
    29911

    I would like to keep it that way, because all further formulas i use, are based on istext and isnumber function, it is just that i would like to have zeros back. :D

    Is it possible to solve my problem?

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,139

    Re: excel deleting zeros - this is a huge problem :)

    Post a sample of your TXT file, please. Make sure there is enough data to demonstrate your need. Make sure your desired results are shown, mock them up manually if necessary. Remember to remove ALL confidential information first!!!

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    The paperclip icon
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Registered User
    Join Date
    09-22-2014
    Location
    europe
    MS-Off Ver
    microsoft office 2010
    Posts
    23

    Re: excel deleting zeros - this is a huge problem :)

    I created a sample, because whole data is not for public

    in "text to column" i use dot as seperator and this works fine... like i said, then excel would go and cut all the zeros before numbers.

    here it is...
    Attached Files Attached Files
    Last edited by oneandtwo; 09-03-2015 at 07:16 AM.

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,351

    Re: excel deleting zeros - this is a huge problem :)

    If you select TEXT in the last option in "Text to Columns" you will retain the zeros.


    0018 data
    001bds data
    000433 data
    sadasdas data
    000056 data

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,139

    Re: excel deleting zeros - this is a huge problem :)

    Hi. Import all your data into a single column and use this:

    =TRIM(MID(SUBSTITUTE("."&$A1,".",REPT(" ",125)),125*COLUMNS($A:A),125))

    drag across and down
    Attached Files Attached Files

  6. #6
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: excel deleting zeros - this is a huge problem :)

    While Converting text to Columns -
    at Step 3 (Convert Text to Column Wizard - Step 3 of 3) Select Text instead of General
    Text to Columns.JPG
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  7. #7
    Registered User
    Join Date
    09-22-2014
    Location
    europe
    MS-Off Ver
    microsoft office 2010
    Posts
    23

    Re: excel deleting zeros - this is a huge problem :)

    Thank you everyone for you nice replies. You are all correct, your all solutions work, however they would change all cells to text. But for me it is esssential that cells which contain only numbers after (trim, text to collumnm option) would remain number cells, however would have the zeros included.

  8. #8
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,351

    Re: excel deleting zeros - this is a huge problem :)

    It is only by using text that you can retain the correct number of leading zeros: why are the leading zeros important in any formula you use?

  9. #9
    Registered User
    Join Date
    09-22-2014
    Location
    europe
    MS-Off Ver
    microsoft office 2010
    Posts
    23

    Re: excel deleting zeros - this is a huge problem :)

    Well the problem is this data is send further, where there is a custom formated cell already and matches exact number... 00034 must be 00034... if there would be 34, it would be a problem

    besides, if i know which cell is number only and which is text i can apply different formula for each cell, which is a well important for the data.

  10. #10
    Registered User
    Join Date
    09-22-2014
    Location
    europe
    MS-Off Ver
    microsoft office 2010
    Posts
    23

    Re: excel deleting zeros - this is a huge problem :)

    Well the problem is this data is send further, where there is a custom formated cell already and matches exact number... 00034 must be 00034... if there would be 34, it would be a problem

    besides, if i know which cell is number only and which is text i can apply different formula for each cell, which is a well important for the data.

  11. #11
    Registered User
    Join Date
    09-22-2014
    Location
    europe
    MS-Off Ver
    microsoft office 2010
    Posts
    23

    Re: excel deleting zeros - this is a huge problem :)

    Well the problem is this data is send further, where there is a custom formated cell already and matches exact number... 00034 must be 00034... if there would be 34, it would be a problem

    besides, if i know which cell is number only and which is text i can apply different formula for each cell, which is a well important for the data.

  12. #12
    Registered User
    Join Date
    09-22-2014
    Location
    europe
    MS-Off Ver
    microsoft office 2010
    Posts
    23

    Re: excel deleting zeros - this is a huge problem :)

    Well the problem is this data is send further, where there is a custom formated cell already and matches exact number... 00034 must be 00034... if there would be 34, it would be a problem

    besides, if i know which cell is number only and which is text i can apply different formula for each cell, which is a well important for the data.

  13. #13
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,351

    Re: excel deleting zeros - this is a huge problem :)

    The formatting of the cell for a number is not material mathematically: 0000034 (Custom format) = 34 (General). So matching 00000034 = 0034 is true.

    Only material when comparing text fields.
    Last edited by JohnTopley; 09-03-2015 at 09:20 AM.

+ 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. Deleting Zeros
    By raphiduani in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-09-2013, 08:15 AM
  2. Excel 2007 VBA - Huge problem with Userform that doesn't initialize
    By CydMM in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-06-2010, 04:10 PM
  3. How to stop Excel deleting leading zeros
    By ndong in forum Excel General
    Replies: 7
    Last Post: 06-24-2010, 08:12 AM
  4. Replies: 2
    Last Post: 07-06-2009, 06:22 AM
  5. Replies: 6
    Last Post: 08-29-2006, 03:52 PM
  6. huge huge excel file... why?
    By Josh in forum Excel General
    Replies: 12
    Last Post: 02-09-2006, 06:00 PM
  7. How to prevent Excel from deleting leading zeros?
    By ljCharlie in forum Excel General
    Replies: 1
    Last Post: 10-31-2005, 07:05 PM
  8. huge problem with 1 excel doc
    By ajisgod in forum Excel General
    Replies: 2
    Last Post: 08-22-2005, 06:37 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