View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Al[_10_] Al[_10_] is offline
external usenet poster
 
Posts: 9
Default Sort on two columns in two dimensional array

Hi David,

My array looks something like this:

| 1 | 2 | 3 | 4
-+------------+------------+------------+------------
1| Fund# | Test# | Currency | Balance
-+------------+------------+------------+------------
2| Fund# | Test# | Currency | Balance
-+------------+------------+------------+------------
3| Fund# | Test# | Currency | Balance

I would like to be able sort on Fund# then Test# so I have the
following:

| 1 | 2 | 3 | 4
-+------------+------------+------------+------------
1| FundA | TestB | Currency | Balance
-+------------+------------+------------+------------
2| FundB | TestA | Currency | Balance
-+------------+------------+------------+------------
3| FundB | TestB | Currency | Balance

The elements are all strings. I know I could dump to a worksheet then
do a sort that way, but I would rather do it via code for speed. And
so I learn how to do it!!

Thanks very much,
Al


"David Fixemer" wrote in message ...
Al,

I'm somewhat confused. A two dimensional array would
look something like:

| 1 | 2 | 3 | 4
-+------------+------------+------------+------------
1| Entry(1,1) | Entry(1,2) | Entry(1,3) | Entry (1,4)
-+------------+------------+------------+------------
2| Entry(2,1) | Entry(2,2) | Entry(2,3) | Entry (2,4)
-+------------+------------+------------+------------
3| Entry(3,1) | Entry(3,2) | Entry(3,3) | Entry (3,4)

Another way of thinking about the problem would be:

| 1 | 2 | 3 | 4
-+------------+------------+------------+------------
1| Entry1 | Entry2 | Entry3 | Entry4
-+------------+------------+------------+------------
2| Entry5 | Entry6 | Entry7 | Entry8
-+------------+------------+------------+------------
3| Entry9 | Entry10 | Entry11 | Entry12


All you want to do is sort "Entry1"
through "Entry12"? I'm confused about sorting in one
direction and then the other? What are your entrys
(Numbers, Strings)?

David Fixemer