Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sorting Algorithm required!


Hi All


Whilst Excel sorting is extremely quick, I sometimes have a need t
sort arrays (and reasonably large ones at that say of the order o
30000 Excel rows and 10 Excel columns sorted by 1 or 2 columns).
tried to do that in VBA Excel for an array of 5500 rows and 10 column
and it took around 5 minutes but Excel sorted the same data in les
than a minute. So in this instance, I did take that option but this ma
not be always possible or feasible!

I am advised that quicksort is pretty efficient for unsorted dat
(whilst performing poorly for nearly sorted dataset - which more tha
likely would never be the case for my dataset) and counting sort i
lighting fast, can anyone help me write (relatively easily) a VBA cod
for either of these sort procedures or gulde me to a website where som
assitance can be available?

For the reason stated above, I would additionally like to be able t
sort arrays using one of the 2 alternatives, if possible!

Any assistance or help shall be highly valued.


Best regards


Deepak Agarwa

--
agarwaldv
-----------------------------------------------------------------------
agarwaldvk's Profile: http://www.excelforum.com/member.php...fo&userid=1134
View this thread: http://www.excelforum.com/showthread.php?threadid=27231

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default Sorting Algorithm required!

Go to the Google newsgroups search, and search the microsoft.public.excel.*
groups for quicksort. Several QS procedures have been posted. But, AIR, they
would have to be modified to sort with two keys. (You can't run QS once on the
less significant key, then a 2nd time on the more significant key, because QS
isn't 'stable'.)


On Mon, 25 Oct 2004 20:29:32 -0500, agarwaldvk
wrote:


Hi All


Whilst Excel sorting is extremely quick, I sometimes have a need to
sort arrays (and reasonably large ones at that say of the order of
30000 Excel rows and 10 Excel columns sorted by 1 or 2 columns). I
tried to do that in VBA Excel for an array of 5500 rows and 10 columns
and it took around 5 minutes but Excel sorted the same data in less
than a minute. So in this instance, I did take that option but this may
not be always possible or feasible!

I am advised that quicksort is pretty efficient for unsorted data
(whilst performing poorly for nearly sorted dataset - which more than
likely would never be the case for my dataset) and counting sort is
lighting fast, can anyone help me write (relatively easily) a VBA code
for either of these sort procedures or gulde me to a website where some
assitance can be available?

For the reason stated above, I would additionally like to be able to
sort arrays using one of the 2 alternatives, if possible!

Any assistance or help shall be highly valued.


Best regards


Deepak Agarwal


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Sorting Algorithm required!

As Myrna Larson points out, if you need to sort by two columns, you want
a stable algorithm and quicksort won't do. The likely candidates are
radixsort (aka counting sort) or mergesort. I can send you either or
both of these in VBA, but are the fields you need to sort on numbers or
strings?

Dave Ring

agarwaldvk wrote:
Hi All


Whilst Excel sorting is extremely quick, I sometimes have a need to
sort arrays (and reasonably large ones at that say of the order of
30000 Excel rows and 10 Excel columns sorted by 1 or 2 columns). I
tried to do that in VBA Excel for an array of 5500 rows and 10 columns
and it took around 5 minutes but Excel sorted the same data in less
than a minute. So in this instance, I did take that option but this may
not be always possible or feasible!

I am advised that quicksort is pretty efficient for unsorted data
(whilst performing poorly for nearly sorted dataset - which more than
likely would never be the case for my dataset) and counting sort is
lighting fast, can anyone help me write (relatively easily) a VBA code
for either of these sort procedures or gulde me to a website where some
assitance can be available?

For the reason stated above, I would additionally like to be able to
sort arrays using one of the 2 alternatives, if possible!

Any assistance or help shall be highly valued.


Best regards


Deepak Agarwal



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Curve fitting algorithm ringo Charts and Charting in Excel 4 January 11th 06 11:46 AM
looking for my perfect algorithm meesh7391 Excel Discussion (Misc queries) 0 January 11th 06 12:06 AM
Algorithm Challenge Lowkey Excel Worksheet Functions 4 July 20th 05 06:40 PM
help with algorithm dreamer[_3_] Excel Programming 6 January 9th 04 02:14 PM
Need help with algorithm RADO[_3_] Excel Programming 1 November 4th 03 12:37 PM


All times are GMT +1. The time now is 11:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"