+ Reply to Thread
Results 1 to 10 of 10

Text file to excel

  1. #1
    Registered User
    Join Date
    02-06-2013
    Location
    PA, USA
    MS-Off Ver
    Excel 2010
    Posts
    18

    Text file to excel

    i have a text file that i would like to export or copy and paste into excel, but the problem is getting it formatted into the correct cells.

    here is an example of what i have in a text file....

    123456 John A. Doe Supplies - Card ARG3452 2014-07-29 110.83-
    123456 P9 DTVC Spend Mgmt - SR1M ARGD394 2014-07-29 1190.37

    This is how i would like it to look in excel, each in its on column...

    123456 John A. Doe Supplies - Card ARG3452 2014-07-29 110.83-
    123456 P9 DTVC Spend Mgmt - SR1M ARGD394 2014-07-29 1190.37

    Any ideas on if i can use a formula or a macro?
    Last edited by sroot; 09-25-2014 at 01:52 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Text file to excel

    How would Excel know where to divide the columns?
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    02-06-2013
    Location
    PA, USA
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Text file to excel

    well i could even make it work if i had the 123456 in one column, all the stuff till the date in another, the date in another, and the dollars in the last one...

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Text file to excel

    How are you importing it now?

  5. #5
    Registered User
    Join Date
    02-06-2013
    Location
    PA, USA
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Text file to excel

    It is being done manually right now. But it is taking over an hour and i am sure there is an easier way to do it.

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Text file to excel

    I don't know what that means, "manually." Are you copying and pasting from NotePad?

    If so, you should instead OPEN the file from Excel, then you can use the text import wizard.

  7. #7
    Registered User
    Join Date
    02-06-2013
    Location
    PA, USA
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Text file to excel

    Yes i am copying and pasting from notepad. That's the problem, I cant import it that way because the information before the dates can have one or more words in it so there is no way to separate it to make all the dates and dollar values in the same column.

  8. #8
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Text file to excel

    Perhaps something like this would be appropriate:

    A
    B
    C
    D
    E
    1
    Number Name Description Date Amount
    2
    123456
    John A. Doe Supplies - Card ARG3452
    29/07/2014
    110.83
    3
    123456
    P9 DTVC Spend Mgm SR1M ARGD394
    29/07/2014
    1190.37
    4


    To do this, commas or tabs would have to be inserted into the correct places (including the headers). The data would look like this:

    Number,Name,Description,Date,Amount
    123456,John A. Doe, Supplies - Card ARG3452,29/07/2014,110.83
    123456,P9 DTVC Spend Mgm, SR1M ARGD394,29/07/2014,1190.37

    I took a guess at what belonged in each column.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  9. #9
    Registered User
    Join Date
    02-06-2013
    Location
    PA, USA
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Text file to excel

    That is how i would like it to look, the problem is getting the commas in there since there can be thousands of records

  10. #10
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Text file to excel

    I copied your sample into Word and used the REPLACE feature then copied the results back into Excel. These are the exact steps that I followed in Word to separate the text into columns.

    Click on Replace and then More and select Use Wildcards.
    1/. Find ([0-9]{4}) ([A-Z]) replace with \1^t\2

    2/. Find space-space (spacebar in place of word space) Replace with ^t

    3/. Find ([0-9]{4}-[0-9]{2}-[0-9]{2}) replace with ^t\1^t

    4/. Find ^l (^ and lowercase L) replace with ^p

    5/. Find -^13 replace with ^p


    This is the result in Excel with only the column width changed to accommodate the data:

    A
    B
    C
    D
    E
    1
    123456
    John A. Doe Supplies Card ARG3452
    29/07/2014
    110.83
    2
    123456
    P9 DTVC Spend Mgmt SR1M ARGD394
    29/07/2014
    1190.37
    Last edited by newdoverman; 09-25-2014 at 04:27 PM.

+ 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. Replies: 1
    Last Post: 02-23-2013, 08:36 AM
  2. Export Excel records to seperate text file & compress it to protecte ZIP file
    By firedragon in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-03-2012, 10:47 AM
  3. Copy Excel to Text file and pass Text file to Access Table
    By robbie_xcell in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-27-2011, 01:53 PM
  4. Convert Excel to formatted text file text file
    By rbpd5015 in forum Excel General
    Replies: 2
    Last Post: 01-14-2011, 10:27 AM
  5. [SOLVED] Saving multi-tab excel file created from comma delimited text file
    By Marcus Aurelius in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-19-2005, 01:20 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