Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You could sort the array and pick the first (or last) 3 rows.
You can pick array sorting routines up easily by doing a sort in Google. The other option is just to loop through the rows of the array and pick up the first 3 rows and then keep replacing the one with the lowest value if there is a row with a higher value. The last option will be faster as it is all done in one pass. RBS wrote in message ups.com... Hi, I am trying to organize an array that I have in VBA. Basically I have a list that looks something like: January 15 February 20 March 40 April 10 (the actual list has more columns and different type of data but the idea is the same). What I would like is to have some code that can go through the array and the producing a new array listing the 3 highest values out of the 4. So the end result would look like: April 10 January 15 February 20 Can anybody give me some help of how that code would look like? Also if you can point me to how to find the answers to those kind of queries in the future? I thought that posting it would be the best way but maybe the answers are already present somewhere and I am just wasting people's time (I have already bought some vba books but could not find an answer in there). Thanks a lot! rgds, Sergio |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Help With Code - Array and Range | Excel Programming | |||
tips for organizing code for distribution | Excel Programming | |||
Can I use array to simplify this code. | Excel Programming | |||
Code for Array formula | Excel Programming | |||
Simplifying code using array | Excel Programming |