Closed Thread
Results 1 to 5 of 5

PREVENT conversion of text to number?

Hybrid View

  1. #1
    Registered User
    Join Date
    08-16-2005
    Posts
    2

    PREVENT conversion of text to number?

    I have a CSV file that I will open (or import) and which has one column that contains serial numbers. The problem is that some of the numbers have this format: 123E567.

    Excel promptly converts this text to a number: 1.23E+569. Even if I then change the format of the cell to text, it still keep the text 1.23E+569.

    How can I either prevent the original text from being converted to begin with or how can I correct it after the fact?

    Best regards,
    Ken

  2. #2
    Dave Peterson
    Guest

    Re: PREVENT conversion of text to number?

    Change the name of the file from .csv to .txt.

    Then when you do file|open, you'll see text to columns wizard pop up. You'll be
    able to specify each field--including this one as Text.



    celticvalley wrote:
    >
    > I have a CSV file that I will open (or import) and which has one column
    > that contains serial numbers. The problem is that some of the numbers
    > have this format: 123E567.
    >
    > Excel promptly converts this text to a number: 1.23E+569. Even if I
    > then change the format of the cell to text, it still keep the text
    > 1.23E+569.
    >
    > How can I either prevent the original text from being converted to
    > begin with or how can I correct it after the fact?
    >
    > Best regards,
    > Ken
    >
    > --
    > celticvalley
    > ------------------------------------------------------------------------
    > celticvalley's Profile: http://www.excelforum.com/member.php...o&userid=26360
    > View this thread: http://www.excelforum.com/showthread...hreadid=396287


    --

    Dave Peterson

  3. #3
    Registered User
    Join Date
    08-16-2005
    Posts
    2
    Thank you very much, Dave. This worked great.

    Have a nice day.
    Ken

  4. #4
    Registered User
    Join Date
    12-02-2014
    Location
    London
    MS-Off Ver
    2010
    Posts
    8

    Re: PREVENT conversion of text to number?

    Reviving an old thread...

    How can the solution given here be replicated using VBA (i.e. when saving a .csv file to .xlsx such that numbers stored as string are not converted to scientific notation)?

    The code I currently have is:

    Sub CSVtoXlsx()
    Dim CSVfolder As String
    Dim XlsFolder As String
    Dim fname As String
    Dim wBook As Workbook
     
    
    inCSVfolder = "c:\temp\output\"
    
    CSVfolder = inCSVfolder
    XlsFolder = inCSVfolder
    
    fname = Dir(CSVfolder & "*.csv")
    
    Do While fname <> ""
       Set wBook = Workbooks.Open(CSVfolder & fname, Format:=6, Delimiter:=",")
       wBook.SaveAs XlsFolder & Replace(fname, ".csv", ""), 51
       wBook.Close False
    fname = Dir
    Loop
     
    End Sub

  5. #5
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: PREVENT conversion of text to number?

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

Closed 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