This is a real situation that many of us already experienced! We have a list of data and we need to get the top N values from that list. Of course we can sort descending the list and get the top values, but many times we can’t sort the source data (it may be used on another report, for instance). We can use the LARGE() function to get the nth largest value from a range of values. The syntax is like this:

LARGE(array, k)

array is the range of data from where we want to get our top values

k is the position on the range of data to return

k is the position on the range of data to return

So, let’s see an example on how to apply this function to get our top values. Our source data is like this:

In this example we want to get the Top 5 companies by Invoices value. We will be putting the values on cells B17:C21.

To start, let’s put the numbers 1 to 5 on cells A17:A21. Now, on cell C17 let’s put our formula, like this:

=LARGE($C$3:$C$15, A17)We will be looking on cells C3:C15, where we have our Invoices values, for the first largest value, that why we are using cell A17 that has the number 1 on it. Use the dollar signs on the array argument so that when we copy the formula to the next rows it will keep the reference to our Invoices values that are on C3:C15. Now copy the formula on cell C17 to the rest of the cells (C18:C21). This is how our sheet should look like:

So, now we have the top 5 Invoices values but wee need to fill the companies names. For that we will use the MATCH() function to get the row number within range C3:C15 that has the value that matches C17. The MATCH formula will be like this:

=MATCH(C17,$C$3:$C$15,0)

For the value in C17, this formula would return 10 because the value on this cell is coming from row 10 of our range source. This is not row 10 of our sheet but row 10 of our source! Now with this information we can get the company name that is on this row. For that we will use the INDEX() function like this:

=INDEX($B$3:$ B$15,10)

This would get the company’s name on row 10 of our source data.

Combining both formulas, it will look like this:

=INDEX($B$3:$B$15,MATCH(C17,$C$3:$C$15,0))

Put this formula on cell B17 and copy to the other cells on B18:B21.

The result will be like this, where we get on cells B17:C21 the top 5 values of Invoices from our source data on B3:C15:

Hope that this article can be useful for your work.
## 13 comentários:

Thanks for the help! However, it is causing the cells to be incorrectly labeled when it encounters two or more of the same value.

Please help. Thanks.

It's true! This solution is for lists that don't have duplicated values.

I agree with your solution. Here is another good explaination of the Large formula...

http://excelprofessor.blogspot.com/2011/10/dashboard-top-5-values-bottom-5-values.html

Thank you

Any ideas how to use this for whole numbers with duplicates?

Really appreciate some help if anyone knows the answer.

THanks a lot this turned out to be most helpful in solving our problem

Regards

HEMANT AND AYUSH

JIM, NOIDA

PGDM (2012-14)

SUBJECT-MIS...

TRIM-3

While this is an interesting and informative exercise this as not a good solution for the stated problem. As others have said it will give incorrect results if there are duplicate values for N.

What if you had another criteria such as Region of the country that you want to pull in the top 5 as you've done here but also want to specify a certain region which would be located within the data on each line?

Good work...

dear one

but i have one more situation where i need ur help

Company Sales

Name (in cr)

A 60

B 56

C 42

D 87

E 80

F 87

G 82

I 10

J 87

L 10

NOW I need to FIND TOP 5 COMPANIES NAME WITH SALES AMOUNT.(i.e. D,F J G and A) but it will gives result as like D D D G A

ur reply is highly expected with regards

this is good post...

i like this...

please can you visit here..

http://bantalsilikon01.blogspot.com/

http://bantalsilikon01.blogdetik.com/

http://bantalkekabumurah.blogspot.com/

http://bumbupecel1.blogspot.com/

http://bantalgood.blogspot.com/

http://bantalsilikonmalang1.blogspot.com/

http://bantalsilikonmurah.blogspot.com/

http://marinirseo.blogspot.com/

http://marinirseo.blogspot.com/

http://marinirseo.blogspot.com/

tengs very much...

What happens if the value is exactly same as another, will this not give error?

A quick workaround would be to make value unique by adding a small fraction to the value e.g. +ROW()*10^-6

Thanks for the Large formula.

Post a Comment