+ Reply to Thread
Results 1 to 8 of 8

Excel removes leading zeros

  1. #1
    Registered User
    Join Date
    04-11-2013
    Location
    Finland
    MS-Off Ver
    Excel 2011 for Mac
    Posts
    7

    Excel removes leading zeros

    Hello,

    When I download data from SAP to file *xls with "text with tabs" it removes leading zeros (two zeros) for certain cells. Can some one explain why this happens?

    For example:
    A1 0019Z09999
    A2 1120078 <- lacking those two leading zeros

    Edit. Now I got it. It doesnt remove leading zeros when there are letters in that cell..
    Last edited by palapeli; 05-09-2017 at 10:16 AM.

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Excel removes leading zeros

    Excel always removes leading zeroes in text files.
    Same goes with CSV files.

    Perhaps export the data with a quote in front then Excel will interpret the data as text.
    But as soon as you perform a calculation on that field the result will have zeroes removed again.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Excel removes leading zeros

    Perhaps this link could be of help?

    https://support.office.com/en-us/art...f-5dfa51f85fe7

    Alf

  4. #4
    Forum Expert avk's Avatar
    Join Date
    07-12-2007
    Location
    India
    MS-Off Ver
    Microsoft Office 2013
    Posts
    3,223

    Re: Excel removes leading zeros

    If you export a file as excel file in SAP using function module GUI_DOWNLOAD, actually it is downloading as a tab delimited format which you can open with Excel or a notepad. If you export as a plain text file, the leading zero will be maintained but if you open with Excel, the leading zero is not maintained because Excel has it own formatting. By default, Excel set a cell as ‘General’ and this formatting will remove any leading zero of a value.


    atul


    If my answer (or that of other members) has helped you, please say "Thanks" by clicking the Add Reputation button at the foot of one of their posts.

    Also: if your problem is solved, please take the time to mark your thread as SOLVED by going to the top of your first post, selecting "Thread Tools" and then "Mark thread as solved".

  5. #5
    Forum Contributor
    Join Date
    08-04-2004
    Location
    Amsterdam
    MS-Off Ver
    2016
    Posts
    186

    Re: Excel removes leading zeros

    You can create a custom format that allows leading zeroes for numbers

  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: Excel removes leading zeros

    Quote Originally Posted by philaugust2004 View Post
    You can create a custom format that allows leading zeroes for numbers
    Formatting cells would not change the values. However, it can be done by formula.

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

    v A B
    1 0019Z09999 0019Z09999
    2 1120078 0001120078
    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

  7. #7
    Forum Contributor
    Join Date
    08-04-2004
    Location
    Amsterdam
    MS-Off Ver
    2016
    Posts
    186

    Re: Excel removes leading zeros

    format with 0000 or as many zeroes as digits in the largest number will add leading zeroes
    ie enter 56 in a cell and create custom format of 0000 and it becomes 0056

  8. #8
    Registered User
    Join Date
    05-13-2015
    Location
    Ireland Cork
    MS-Off Ver
    2011
    Posts
    1

    Re: Excel removes leading zeros

    Excel has an easy solution now, to avoid automatic data conversion.

    File >
    Data >
    Automatic data conversion >
    Remove leading zeros (uncheck)

+ 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. how to get excel to keep in leading zeros
    By teriscibetta in forum Excel General
    Replies: 5
    Last Post: 08-27-2015, 08:49 AM
  2. [SOLVED] Question - Leading Zeros in Excel
    By prvimoon in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 03-21-2014, 08:34 PM
  3. Excel Leading Zeros
    By [email protected] in forum Excel General
    Replies: 3
    Last Post: 01-17-2006, 03:10 PM
  4. support for leading zeros in excel
    By Vincenzo in forum Excel General
    Replies: 1
    Last Post: 12-30-2005, 12:20 PM
  5. How to suppress leading zeros in Excel
    By Jay in forum Excel General
    Replies: 2
    Last Post: 07-26-2005, 09:05 PM
  6. leading zeros in excel
    By kiwi in forum Excel General
    Replies: 4
    Last Post: 05-17-2005, 02:06 PM
  7. Replies: 1
    Last Post: 05-04-2005, 02:06 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