Closed Thread
Results 1 to 11 of 11

Convert multi-line records to single line?

  1. #1
    Registered User
    Join Date
    11-19-2009
    Location
    arizona
    MS-Off Ver
    Excel 2003
    Posts
    4

    Convert multi-line records to single line?

    I have about 2.5 million rows in the format listed below. I was wondering if there was an easy way (in excel or access) to format them to the second example listed below.
    So that if <column A> has multiple matching values all of their <column B> values could be moved to a single line.

    100 BOB
    100 JON
    100 MARK
    101 BOB
    101 TIM
    102 CHRIS

    I would like to convert it to :
    100 BOB JON MARK
    101 BOB TIM
    102 CHRIS

  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: Convert multi-line records to single line?

    These aren't in Excel; are they in text files? If so, post an abbreviated example.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Convert multi-line records to single line?

    Here, try this:

    Samplebook(1).xls

  4. #4
    Registered User
    Join Date
    11-19-2009
    Location
    arizona
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Convert multi-line records to single line?

    I attached a img of the some screenshots to help show what i mean

    *All names used have been changed to fake names
    Attached Images Attached Images

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

    Re: Convert multi-line records to single line?

    i wonder how long that would take to calculate on 2.5 million rows?(not that there are in xl2003,or 2007 either!)
    its not a criticism but a genuine interest.
    Last edited by martindwilson; 11-19-2009 at 06:12 PM.
    "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

  6. #6
    Registered User
    Join Date
    11-19-2009
    Location
    arizona
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Convert multi-line records to single line?

    Quote Originally Posted by martindwilson View Post
    i wonder how long that would take to calculate on 2.5 million rows?
    its not a criticism but a genuine interest.
    Well since its being one in ether excel 2003 it will be done 65k records at a time =x

    unless access has a better / faster way.

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

    Re: Convert multi-line records to single line?

    thats why shg asked how they are currently stored eg text probably with a view to using some code to import it

  8. #8
    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: Convert multi-line records to single line?

    If they were on a sheet as described,
    Please Login or Register  to view this content.
    If they were in a text file, I'd do it from the text file.

  9. #9
    Registered User
    Join Date
    11-19-2009
    Location
    arizona
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Convert multi-line records to single line?

    You sir are brilliant!! Thank you very much!

    A note I wanted to add to the vba snippet posted above.

    *It works great except the very last record it doesn't move. I move it manualy however I'm sure if you are better at excel vba you can fix this yourself.

    I included a small img to show what I mean. I only used "100" for matching criteria. If you have a large range of numbers it only doesnt move the very last set of matching numbers. I hope this makes sense =x
    Attached Images Attached Images
    Last edited by automator; 11-20-2009 at 04:49 PM.

  10. #10
    Registered User
    Join Date
    06-07-2010
    Location
    usa
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Convert multi-line records to single line?

    Could you please help me to Read this from TEXT file .
    In My case TEXt file is something like this

    1235 1/1/2002 ghhjkjk
    fdgsgfh
    fdfgdfdhjh
    2/1/2002 ggdfdhjjk
    fhdgfd
    1236 1/2/2002 ghdfgjd
    1237 1/2/2002 hgjfhkgk

    and i want to read it like this

    1235 1/1/2002 ghhjkjkfdgsgfhfdfgdfdhjh
    1235 2/1/2002 ggdfdhjjkfhdgfd
    1236 1/2/2002 ghdfgjd
    1237 1/2/2002 hgjfhkgk

    I can open it in Excel too so anything would be fine. Thanks in advance

  11. #11
    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: Convert multi-line records to single line?

    Welcome to the forum, SWAPNILAGRAWAL.

    Please take a few minutes to read the forum rules, and then start your own thread.

    Thanks.

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