+ Reply to Thread
Results 1 to 10 of 10

VBA/Macros - sorting across multiple repetitive columns

  1. #1
    Registered User
    Join Date
    10-10-2009
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    52

    VBA/Macros - sorting across multiple repetitive columns

    Good day. Hopefully someone can help with this? I have attached an example spreadsheet with two tabs. The first tab (Matrix) shows raw data scores - there are 28 measures in Column A and Participants in Row 1. There are always 28 measures but participants can vary. What I need to happen is to sort each measure in a Lineup tab i.e. rank all the participants listed in the Matrix tab from lowest score to highest score for each of the 28 measures. Obviously this can be done manually but a VBA/macro solution will be so much faster and easier. Unfortunately I have to keep the data in this format so the macro will need to transpose the data to get into the formt in the Lineup tab. Thanks for you assistance.

    test.xlsx

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: VBA/Macros - sorting across multiple repetitive columns

    See next code
    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    10-10-2009
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    52

    Re: VBA/Macros - sorting across multiple repetitive columns

    Sorry for the delay in getting back to you. This looks very good and works well with this data set. However, I sometimes have to use quite large data sets i.e. over 1,000 participants. Is it possible to design the code to take into account such a large number of participants? I think currently this code only analyses 15 participants which is probably due to fact that the transpose element of the code uses Columns P:AT. Could we solve this by creating another tab e.g. Transpose where this data can be copied to instead of using the Matrix tab?

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA/Macros - sorting across multiple repetitive columns

    Hi almugs,

    I've been going nuts trying to find this post - I found it by searching "28 measures" (almugs didn't work) - well, anyway, try this:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  5. #5
    Registered User
    Join Date
    10-10-2009
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    52

    Re: VBA/Macros - sorting across multiple repetitive columns

    Again very impressive. But still hasn't solved the additional problem when I have additional participants (which can be upto 500 and beyond) . I get the following message "Run Time Error "9" Subscript out of Range" when I have data in column AE and beyond (30 participants). Data upto column AD (29 participants seems to work fine).

    test (2).xlsm

  6. #6
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: VBA/Macros - sorting across multiple repetitive columns

    Try
    Please Login or Register  to view this content.

  7. #7
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA/Macros - sorting across multiple repetitive columns

    Hi Almugs,

    Try this version:

    Please Login or Register  to view this content.
    Last edited by xladept; 01-29-2014 at 04:02 PM.

  8. #8
    Registered User
    Join Date
    10-10-2009
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    52

    Re: VBA/Macros - sorting across multiple repetitive columns

    Brilliant. Thanks both for all your help with this. Both solutions work well now. However, xladept's solution appears to be much faster. I will do some more testing with bigger datasets but believe you have both cracked this.

  9. #9
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA/Macros - sorting across multiple repetitive columns

    Great! You're welcome!

  10. #10
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: VBA/Macros - sorting across multiple repetitive columns

    xladept's solution is clearly faster.
    If there is still speed issue some others possibilities exist but a bit longer to prepare

+ 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. [SOLVED] Macros to transpose from multiple columns to selected columns and maintaining cell format
    By rrajnish in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-09-2013, 01:45 PM
  2. Repetitive columns to simple horizontal table
    By normanlang in forum Excel General
    Replies: 5
    Last Post: 06-01-2013, 07:17 AM
  3. Replies: 2
    Last Post: 12-04-2012, 12:16 AM
  4. [SOLVED] Delete multiple empty cells in multiple columns and moving data up, witout Macros
    By CoraF in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-30-2012, 08:23 AM
  5. repetitive macros-solved
    By henrysmith in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-06-2009, 12:48 PM

Tags for this Thread

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