VBA for top 5 entries by sum of groups

Chujaixd

New Member
Joined
Jul 16, 2019
Messages
2
Hi all

I am trying to analyse the following dataset and get the total amount of first 5 items of each group(2 grps in total).

I tried to use sumifs but since there are too many unique items in my data, selecting and filtering makes the table too complicated.

Thanks for the help in advance!

Input
Name.....Group.....Amount
AAA.....1..........10
AAA.....1..........20
AAA.....2..........40
BBB.....2..........50
CCC.....1..........60

Output
Name.....Group.....Amount
CCC....1..........60
AAA.....1..........30
BBB.....2..........50
AAA.....2..........40
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Do you need a VBA code for this?

If not, I think this way should work:
1. combine name and group like "CCC - 1", "AAA - 2"......etc
2. a pivot table
 
Upvote 0
Will that work if VBA do the same steps as below?

1. combine name and group like "CCC - 1", "AAA - 2"......etc
2. a pivot table
3. sort a
mount from largest to smallest

 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top