+ Reply to Thread
Results 1 to 8 of 8

Sorting large volumns of data

  1. #1
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Sorting large volumns of data

    I have a worksheet that is 20 columns wide and can contain between 20000 and 30000 rows.
    Each row has to be sorted independently of the others.
    I tackle this in VBA by selecting each row in turn and using the Excel sort procedure.
    With 30000 rows this takes about 5 minutes.
    It has occurred to me that it would be much faster if I created an array for the data and then sorted each row of this. I don't think that I will then be able to use the Excel sort procedure though.
    Can anyone please suggest a way forward. Is there a VBA Sort command, (I have not found one), for instance.
    John

  2. #2
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: Sorting large volumns of data

    Hm, how exactly do you sort a single row?
    If you are pleased with a member's answer then use the Star icon to rate it.

  3. #3
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Re: Sorting large volumns of data

    Buran
    A row with the following aaverftyu would sort to aaefrtuy without reference to any of the other rows.
    John

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Sorting large volumns of data

    Maybe:

    Please Login or Register  to view this content.
    Last edited by JOHN H. DAVIS; 04-11-2014 at 10:47 AM.

  5. #5
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Re: Sorting large volumns of data

    John
    Thanks for your interest. Your solution is much the same as the one I am currently using. It works but takes a long time. I am assuming that this is because the code is repeatedly having to refer to the worksheet for each I.
    What I think I want would have something like
    Please Login or Register  to view this content.
    It is the line SORT(SortArray(I,20) that I am hoping to find
    John

  6. #6
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Re: Sorting large volumns of data

    I have just realised the importance of Application.ScreenUpdating = False and am going to try it
    John

  7. #7
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Re: Sorting large volumns of data

    Just for interest as this is an old post now. I loaded the data into an array, and then sorted each row using a bubble sort algorithm I found on line. Then I loaded the sorted array back into the worksheet. With 25000 rows with each row being about 40 columns long (The rows all varied) the sort took about 2 seconds. Done using the Excel sort command by selecting each row from the sheet first the sort could take from 4 to 6 minutes. This was presumably due to the time taken to continually access the worksheet as I think the sort command is very fast in its self.
    John

  8. #8
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Sorting large volumns of data

    Thanks for sharing that. I for one can surely use that info for future reference.

+ 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. Sorting large groups of data..
    By GroupStats in forum Excel General
    Replies: 3
    Last Post: 06-17-2013, 12:48 AM
  2. Sorting/Rearranging Large data set
    By flashyoyo in forum Excel General
    Replies: 1
    Last Post: 10-04-2012, 07:04 PM
  3. Sorting/Rearranging Large data set
    By flashyoyo in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 10-04-2012, 11:00 AM
  4. Sorting large data set
    By David1234 in forum Excel General
    Replies: 0
    Last Post: 09-27-2011, 06:31 PM
  5. Sorting problem with large data set
    By Infinity666 in forum Excel General
    Replies: 4
    Last Post: 10-20-2009, 11:56 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