![]() |
Multi-column two-dimensional quick sort
Hi -
I've gone through many of the old posts on quick sorting and haven't quite come across what I think would solve my problem. I have a very large array that has been loaded from multiple worksheets. In general, its somewhere in the neighborhood of 100,000 rows x 10 columns. What I'd like to do is sort all the information based first on the values in each of the rows and one of the columns and then within that set, sorting on a second column, and so on until the entire array has been sorted by each of the columns. What I've seen will sort on any one column within a 2-d array, but not multiple columns. Thanks in advance |
Multi-column two-dimensional quick sort
You could try loading the data into an ADO recordset and using the
recordset's sort method. could expand/modify this (see second example): http://groups.google.com/groups?hl=e...%40cppssbbsa05 Tim. "Marston" wrote in message om... Hi - I've gone through many of the old posts on quick sorting and haven't quite come across what I think would solve my problem. I have a very large array that has been loaded from multiple worksheets. In general, its somewhere in the neighborhood of 100,000 rows x 10 columns. What I'd like to do is sort all the information based first on the values in each of the rows and one of the columns and then within that set, sorting on a second column, and so on until the entire array has been sorted by each of the columns. What I've seen will sort on any one column within a 2-d array, but not multiple columns. Thanks in advance |
Multi-column two-dimensional quick sort
"Tim Williams" wrote ...
I have a very large array that has been loaded from multiple worksheets. What I've seen will sort on any one column within a 2-d array, but not multiple columns. You could try loading the data into an ADO recordset and using the recordset's sort method. A good suggestion. However, rather than fabricating a recordset based on the array, the OP may be able to create the recordset already populated *and* sorted using the worksheet data, all in one query e.g. SELECT MyCol1 AS Col1, MyCol2 AS Col2, MyCol3 AS Col3, MyCol3 AS Col4 FROM [Sheet1$] UNION SELECT MyColA AS Col1, MyColB AS Col2, MyColC AS Col3, MyColD AS Col4 FROM [Sheet2$] ORDER BY 1,2,3,4 ; If you then need an array, use the recordset's GetRows method. Jamie. -- |
All times are GMT +1. The time now is 10:34 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com