Finding the top n elements in a range

pkd

New Member
Joined
Nov 3, 2011
Messages
2
Hi,

I need to find top/bottom N elements in a range. I have created an array out of the range. I am not sure how to find the top/bottom elements? LARGE function would give me the actual value, however I am interested in finding the indexes. Please help
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Hi, welcome to the board.

Why not try the INDEX and LARGE functions together, possibly with the assistance of the MATCH function ?
 
Upvote 0
Can you provide an example?

Lets say I have a range A1:A100, and I have created an array out of it. My array is integerArray(1 to 100, 1 to 1). Now, I need to find the top 3 elements in this array, and their indexes. Where do I go from here (without doing a for loop)?
 
Upvote 0
So long as all your values are unique . . .
Code:
=LARGE(A1:A100,3)
will return the 3rd largest value.

And this
Code:
=match(large(a1:a100,3),a1:a100,0)
will return its position in the array.
 
Upvote 0

Forum statistics

Threads
1,214,806
Messages
6,121,672
Members
449,045
Latest member
Marcus05

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top