+ Reply to Thread
Results 1 to 5 of 5

How Do I Prevent Excel from Formatting My Text File?

  1. #1
    Forum Contributor
    Join Date
    05-29-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    2021
    Posts
    205

    How Do I Prevent Excel from Formatting My Text File?

    When I export my files onto text and open it with Excel, it will automatically format the cells to take out leading zeros, convert to scientific notation, and convert certain numbers into date/month/year format. How can I get Excel to open my file without reformatting the numbers in my text file?

    Thanks
    Ocean
    Last edited by Ocean Zhang; 07-24-2009 at 10:28 AM.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: How Do I Prevent Excel from Formatting My Text File?

    dont open it directly with excel use the get external data from the data tab
    choose from text
    find your text file click import
    when the wizard pops up
    make sure delimited is checked
    click next
    click next again
    click first field
    use ctrl+shift click last field to select all fields
    under column data format
    check the text box
    all fields should now say text instead of general
    click finish
    in the window that pops up choose where you want it to start import to (usually =$A$1 of existing worksheet
    click ok
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: How Do I Prevent Excel from Formatting My Text File?

    Hi Ocean,

    when you open a text file with Excel 2003, the text import wizard asks about delimeters, etc, and then presents a screen where you can go to each column and define what format the data should be, e.g. General (which will strip away leading zeros and use scientific notation for large numbers) or text (which will leave leading zeros in place, e.g. for phone numbers).

    I'm not quite sure if 2007 opens that Wizard too, but I assume it should.

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: How Do I Prevent Excel from Formatting My Text File?

    correct excel 2007 opens the wizard any way i never checked that
    just follow the same steps as i said from "when the wizard pops up"
    dang 2007 lol

  5. #5
    Forum Contributor
    Join Date
    05-29-2009
    Location
    Chattanooga, TN
    MS-Off Ver
    2021
    Posts
    205

    Re: How Do I Prevent Excel from Formatting My Text File?

    That worked great. Thanks!!!

+ 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