+ Reply to Thread
Results 1 to 4 of 4

Multiple Rows to One Row

  1. #1
    Registered User
    Join Date
    01-28-2010
    Location
    Chicago
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    30

    Question Multiple Rows to One Row

    I have a spreadsheet that has patient information and each patient has multiple rows because they have multiple different diagnosis and/or procedure codes. I want each patient to have one row and each diagnosis, procedure, etc is in its own cell/column. There can be up to 30 Diagnosis codes and 30 Procedure codes for one patient. Each patient has a unique ID number, which is what I would want to base the pivot on, but each patient can have a different number of diagnosis/procedure codes.

    Please help! I've tried a pivot table, which wont get me one row per patient.

    Thanks in advance!

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Multiple Rows to One Row

    'COLUMN DATA TO ROW DATA
    I have a macro that may be "ready to use" for merging rows of data to one row matching for column A.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    01-28-2010
    Location
    Chicago
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    30

    Re: Multiple Rows to One Row

    Your macro seems like it will be perfect and exactly what I am trying to do. I tried pasting it into my file and I got a "Run Time Error '1004': Method 'Range' of object '_Global' failed." When I go to the Debugger, it highlights this:

    Please Login or Register  to view this content.
    How can I fix that?

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Multiple Rows to One Row

    A couple of lines of code above that the LastRow variable was resolved by searching column A for the last cell with data. The line of code you've noted is simply the delRNG seeding itself on an empty row so that it can be easily added to later.

    There's nothing wrong with the code, used it many times, so there must be something in your workbook you haven't explained yet.

    Click GO ADVANCED and use the paperclip icon to post up a desensitized copy of your workbook. We'll look at it together. Make sure the macro is already installed.

+ 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