ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selecting next to highest number in an array? (https://www.excelbanter.com/excel-programming/376965-selecting-next-highest-number-array.html)

[email protected]

Selecting next to highest number in an array?
 
I have a array variable defined and I want to be able to pull out the
1st, 2nd, 3rd highest number out of all the available numbers.

For example
Mydata(1) = 3
Mydata(2) = 1
Mydata(3) = 4
Mydata(4) = 5

Is there a way to get the highest number out of the array? The 2nd
highest number?

I know I can do a little subroutine, but I'm hoping there's a more
direct way to get the relative numbers.

Thanks.


Gary''s Student

Selecting next to highest number in an array?
 
Transfer the array into a worksheet column and then sort the column descending.
--
Gary's Student


" wrote:

I have a array variable defined and I want to be able to pull out the
1st, 2nd, 3rd highest number out of all the available numbers.

For example
Mydata(1) = 3
Mydata(2) = 1
Mydata(3) = 4
Mydata(4) = 5

Is there a way to get the highest number out of the array? The 2nd
highest number?

I know I can do a little subroutine, but I'm hoping there's a more
direct way to get the relative numbers.

Thanks.



Tom Ogilvy

Selecting next to highest number in an array?
 
Sub ABC()
Dim mydata(1 To 4)
mydata(1) = 3
mydata(2) = 1
mydata(3) = 4
mydata(4) = 5

MsgBox Application.Large(mydata, 1)
Msgbox Application.Large(mydata,2)
' etc
End Sub

--
Regards,
Tom Ogilvy


wrote in message
oups.com...
I have a array variable defined and I want to be able to pull out the
1st, 2nd, 3rd highest number out of all the available numbers.

For example
Mydata(1) = 3
Mydata(2) = 1
Mydata(3) = 4
Mydata(4) = 5

Is there a way to get the highest number out of the array? The 2nd
highest number?

I know I can do a little subroutine, but I'm hoping there's a more
direct way to get the relative numbers.

Thanks.





All times are GMT +1. The time now is 06:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com