+ Reply to Thread
Results 1 to 7 of 7

Convert multiple rows into one, vertical to horizontal data

  1. #1
    Registered User
    Join Date
    04-30-2009
    Location
    Boston, Massachusetts
    MS-Off Ver
    Excel 2003
    Posts
    4

    Convert multiple rows into one, vertical to horizontal data

    Hello, thank you for trying to help me out here. I am conducting a relatively large research project, and could really use some help.

    I have a data set in Excel which consists of a list of all the dates that different patients were seen in a clinic. It is arranged like this:

    Patient A Date1
    Patient A Date2
    Patient A Date3
    Patient B Date1
    Patient B Date2
    Patient C Date1
    Patient C Date2
    Patient C Date3
    Patient C Date4
    Patient D Date1

    What I would like to do, if possible, is have one row per patient, so that it would look like this:

    Patient A Date1 Date2 Date3
    Patient B Date1 Date2
    Patient C Date1 Date2 Date3 Date4
    Patient D Date1

    What I want to be able to do is sort patients by the first date they were seen. Right now the patient names are organized alphabetically, but I care about the order they were initially seen.

    Thank you so much for any help you can give!
    Last edited by VBA Noob; 04-30-2009 at 12:46 PM.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,607

    Re: Convert multiple rows into one, vertical to horizontal data

    Try this. It assumes your data are in two columns (A&B) and outputs them into two (D&E). It can be revised if required.
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    04-30-2009
    Location
    Boston, Massachusetts
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Convert multiple rows into one, vertical to horizontal data

    Thank you so much. My data is in two columns, but I think what I would hope to create would be in more than two. Like in the example I showed, each patient may have a different number of visits, and each visit obviously has a separate date. The minimum number of visits per patient is 1 visit, and the maxiumum is probably around 10 visits.

  4. #4
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,607

    Re: Convert multiple rows into one, vertical to horizontal data

    Try adding the second line below (the first is already there):
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-30-2009
    Location
    Boston, Massachusetts
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Convert multiple rows into one, vertical to horizontal data

    Am I supposed to replace the first line with the second line, or just add the second line in the code between

    Please Login or Register  to view this content.
    Last edited by VBA Noob; 04-30-2009 at 01:22 PM.

  6. #6
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,607

    Re: Convert multiple rows into one, vertical to horizontal data

    Just add those two lines and get rid of the AutoFit line.

  7. #7
    Registered User
    Join Date
    04-30-2009
    Location
    Boston, Massachusetts
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Convert multiple rows into one, vertical to horizontal data

    Holy cow - I think that worked! Thanks so much. I'll let you know if I have any problem, but it looks good at first glance. You're a genius.

+ 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