excel - List top n items in column, which have highest sum in second column -


so have spreadsheat this, each row contract company:

company | revenue ------- | ------- facebook| 1000000 google  | 1000000 facebook| 100000 john doe| 123 john doe| 100 john doe| 8 john doe| 50 foo inc.| 100 

now want list top n companies revenue. lets n=2 should this:

company  | revenue sum -------- | ----------- facebook | 1100000 google   | 1000000 remainder| 381 

i'm looking excel formula this, cannot use vba. tried array formulas sumif , match, don't seem right.

you can purely formulas (no pivot table or vba). data in column a , b, in e2 enter:

=large(b:b,row()-1) 

and copy down. sorts contents of column b. need find rows in values reside. in f2 enter:

=match(e2,b:b,0) 

and in f3 enter:

=if(countif($e$1:$e3,e3)>1,match(e3,indirect("$b" & f2+1 & ":b9999" ),0)+f2,match(e3,b:b,0)) 

and copy down. formula gets rows , handles duplicates in column b.

finally in d2 enter:

=index(a:a,f2) 

and copy down:

enter image description here


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -