+ Reply to Thread
Results 1 to 12 of 12

Merge Columns to Rows

  1. #1
    Registered User
    Join Date
    12-10-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    39

    Exclamation Merge Columns to Rows

    Hi,

    I have a spreadsheet that holds student assessment data for each of their subjects (each subject has 6 data items), i.e. 1 row per student. However, I need to be able to arrange this data as 1 row per student per subject - I know this may be vague, so I have attached a sample spreadsheet which can be downloaded here: http://www.filedropper.com/sampledata-mergecolstorows

    (I couldn't attach it directly to this thread as nothing happened when I clicked the 'attachment' button - sorry!)

    Can anyone help with a macro that will help me do this?

    Thank you in advance!
    Last edited by ilsley_excel; 06-27-2016 at 09:47 AM.

  2. #2
    Registered User
    Join Date
    12-10-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    39

    Re: Merge Columns to Rows

    Any takers?

  3. #3
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Merge Columns to Rows

    maybe so
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    12-10-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    39

    Re: Merge Columns to Rows

    Quote Originally Posted by nilem View Post
    maybe so
    Please Login or Register  to view this content.

    Hi! Thank you very much for this. It seems to work perfectly well with the sample data I attached! :-)

    However, when I try to use it for real data (i.e. where there about around 200 rows for each student, and about 10 or 11 subjects [approx. 60/66 columns] for each of those students), the code breaks at this point:

    y(k, n + 4) = x(i, j + n)

    The error I get is 'subscript out of range'.

    Is there any way of tweaking this code so that it takes into account these extra rows/columns?

  5. #5
    Registered User
    Join Date
    12-10-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    39

    Re: Merge Columns to Rows

    Help please... still trying to figure this out. :-(

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Merge Columns to Rows

    Please attach the sample (Excel book with a desired result) you are working on with the code and will adjust it for you.
    Nilem did not see your sample when he wrote the code.

  7. #7
    Registered User
    Join Date
    12-10-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    39

    Re: Merge Columns to Rows

    Quote Originally Posted by AB33 View Post
    Please attach the sample (Excel book with a desired result) you are working on with the code and will adjust it for you.
    Nilem did not see your sample when he wrote the code.

    Hi. How can I attached a sample sheet? I can't see the option anywhere....

  8. #8
    Registered User
    Join Date
    12-10-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    39

    Re: Merge Columns to Rows

    Ah, I found the 'attach file' button, but when I click it, nothing happens. Maybe our IT department at work have blocked pop-ups.

    In any case, the sample spreadsheet can be downloaded from this link: http://www.filedropper.com/sampledata-mergecolstorows

  9. #9
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Merge Columns to Rows

    The code works on the sample, but not on real data. Click Go advance, then at the bottom, you will see "Manage attachment" Upload Files from your Computer will take to your folder.

  10. #10
    Registered User
    Join Date
    12-10-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    39

    Re: Merge Columns to Rows

    Quote Originally Posted by AB33 View Post
    The code works on the sample, but not on real data. Click Go advance, then at the bottom, you will see "Manage attachment" Upload Files from your Computer will take to your folder.
    I've attached the sample spreadsheet now...

    Thanks in advance!
    Attached Files Attached Files

  11. #11
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Merge Columns to Rows

    Ah dah!

    Nilem code works on the sample attached.
    Then I asked you to attach a sample book which mimics your actual result, but you attached the same sample book.
    The code is sensitive to boundry, so we know to know your data layout.
    Please attach a sample which resembles your actual data. You can remove confidential info, we just interested on the layout and format of your actual data
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    12-10-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    39
    Quote Originally Posted by AB33 View Post
    Ah dah!

    Nilem code works on the sample attached.
    Then I asked you to attach a sample book which mimics your actual result, but you attached the same sample book.
    The code is sensitive to boundry, so we know to know your data layout.
    Please attach a sample which resembles your actual data. You can remove confidential info, we just interested on the layout and format of your actual data
    Ah, right. I'm at home now, so will post a full sample tomorrow when I'm back at work.

+ 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. Merge Duplicate Rows unique values into single rows for an infinite amount of columns/rows
    By aimeecrystalaid in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-21-2013, 08:43 PM
  2. [SOLVED] Merge multiple duplicate rows into columns - more than 65536 rows
    By a3des in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-05-2013, 09:18 AM
  3. [SOLVED] Merge duplicate rows and merge the columns (approx 10 columns)
    By adfeddon in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-02-2012, 11:19 AM
  4. Merge duplicate rows and their columns
    By wali in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-17-2011, 06:35 AM
  5. Merge Rows into Columns with more than one variable
    By Dimonds in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 11-26-2007, 02:11 AM
  6. Can I merge rows to columns
    By miche in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 04-15-2006, 05:50 PM
  7. [SOLVED] How to merge rows of data in 2 columns into 1 col.
    By Pianoman in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 12-06-2005, 01:35 AM

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