Selecting next to highest number in an array?

R

robotman

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.
 
G

Gary''s Student

Transfer the array into a worksheet column and then sort the column descending.
 
T

Tom Ogilvy

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top