Hugo Almeida
Hugo Almeida

Reputation: 49

Excel Sum Top N Values

I have the following table:

enter image description here

And I want to sum the top N values. N being the number in cell A1, which can be any number, like 2 or 7.

I know how to do with a fixed number, like:

=SUM(LARGE(B1:B9;{1;2;3;4}))

But what if the number of companies I want to sum changes?

Thanks!

Upvotes: 0

Views: 708

Answers (1)

Harun24hr
Harun24hr

Reputation: 36880

There are couple of ways. Try any of the following

=SUM(LARGE(B2:B9,SEQUENCE(5)))
=SUM(INDEX(SORT(B2:B9,1,-1),SEQUENCE(5)))
=SUM(FILTER(B2:B9,B2:B9>=LARGE(B2:B9,5)))

enter image description here

Upvotes: 1

Related Questions