Reputation: 49
I have the following table:
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
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)))
Upvotes: 1