LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sort array with 2 dimensions?


I have an array:


Code:
--------------------

ReDim Preserve AllCustomers(1 To 21, 1 To 7)

--------------------


The array contains the following data:
(Below, contains data for customer 1.)
-----------------------------------------------------
AllCustomers(1 , 1 ) contains CustomerNo
AllCustomers(1 , 2 ) contains Date
AllCustomers(1 , 3 ) contains Address
.......
........
AllCustomers(1 , 7 ) contains Duration
etc
-----------------------------------------------------

(While, belowcontains data for customer 2.)
-----------------------------------------------------
AllCustomers(2 , 1 ) contains CustomerNo
AllCustomers(2 , 2 ) contains Date
AllCustomers(2 , 3 ) contains Cost
.......
........
AllCustomers(1 , 7 ) contains Duration
etc
-----------------------------------------------------




I want to sort them by CustomerNo which is a string in the format
'M*****', where * is a numeric value.

With a normal, single dimension array I would use Right() on CustomerNo
and then sort using these values. However, I want to sort by the
CustomerNo (which is in the 2nd dimension), and want all the values
that correspond with the customer,
to move with the CustomerNo.

e.g.

unsorted
------------
M00021, 13/02/2005, 80.00,....,....,2
to
M00001, 12/02/2005, 40.00,....,....,1


when sorted
----------------
M00001, 12/02/2005, 40.00,....,....,1
to

M00021, 13/02/2005, 80.00,....,....,2

Any ideas on how to sort this would be greatly appreciated. Just never
used more than one dimension before.


--
eclipse
------------------------------------------------------------------------
eclipse's Profile: http://www.excelforum.com/member.php...o&userid=28372
View this thread: http://www.excelforum.com/showthread...hreadid=479596

 
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
Array... Sort of... Egon Excel Worksheet Functions 2 October 19th 05 05:47 PM
Array function, two dimensions?? and worksheet arrays Neal Zimm Excel Programming 7 October 3rd 05 09:16 PM
Array function, two dimensions?? Neal Zimm Excel Programming 0 October 1st 05 04:14 PM
Checking existence of array dimensions kdw Excel Programming 2 November 9th 04 08:32 PM
Checking Number of Dimensions In Array DigableP Excel Programming 2 February 28th 04 11:18 PM


All times are GMT +1. The time now is 01:40 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"