Q:

Excel List Top Occurring Numbers

I've search but haven't found an example that finds the top 3 occurring numbers in a list. Most code is for text, top scoring or top 3 biggest values.
I have a list of orders with part numbers and prices that occurred during the year.

-A---------B---------C-------D-------E
      60470     $58
      60470     $58
      89038     $60
      31859     $37
      60470     $58
      29079     $78
      35568     $40
      82677     $92
      69172     $37
      31859     $37
      89038     $60
      31859     $37
      31859     $37
      60470     $58
      31859     $37
      60470     $58
      31859     $37  

Column A has the part numbers and Column B has the prices. In Column D I would like to list the top 3 most occurring part numbers from column A and then then in Column E the sum total from all their occurrences.
In the example above, Column D and E would show the following respectively:
31859 $222.00
60470 $290.00
89038 $120.00  
I really can't sort or add "helper" columns so I am trying to accomplish this using an array formula.

A:

In D1, array formula**:
=INDEX(A$1:A$17,MATCH(LARGE(IF(FREQUENCY(A$1:A$17,A$1:A$17),FREQUENCY(A$1:A$17,A$1:A$17)+ROW(A$1:A$17)/10^6),ROWS($1:1)),FREQUENCY(A$1:A$17,A$1:A$17)+ROW(A$1:A$17)/10^6,0))
In E1:
=SUMIF(A$1:A$17,D1,B$1:B$17)
Regards

