Macro to get TOP X (10/20/50 etc) records based on selection criteria

nikhil0311

Board Regular
Joined
May 3, 2013
Messages
200
Office Version
  1. 2013
Platform
  1. Windows

Excel 2007
ABCDEFG
1Raw Data
2RelevantNameDateRegionProduct MappingStageRevenue
3YCognizant3-Dec-17APACCCBid$ 50
4NABC Ltd3-Oct-17CANLiqMandate$ 65
5YCiti10-Jul-17EMEAFXOpp$ 20
6YBarclays3-Dec-18LATAMLendLost$ 15
7YEmirates3-Dec-17APACCCNQO$ 14
8YEthihad3-Oct-17APACLiqBid$ 19
9YCiti10-Jul-18LATAMCCMandate$ 20
10YCiti3-Dec-27LATAMLiqOpp$ 65
11NCiti3-Dec-25LATAMCCLost$ 47
12YABC Ltd3-Dec-17CANFXMandate$ 85
13YInfosys3-Oct-17CANFXClosed$ 63
14YWipro3-Dec-17APACCCNQO$ 23
15YSony3-Oct-17APACLiqBid$ 67
16YLG10-Jul-18LATAMCCMandate$ 27
17YSony3-Dec-27LATAMLiqOpp$ 20
18NMicromax3-Dec-25LATAMCCLost$ 22
19YMotorola3-Dec-17CANFXClosed$ 34
20YSamsung3-Oct-17CANFXClosed$ 16
Sheet2




Excel 2007
IJ
1Filter Criteria
2FiltersSelection criteria
3RelevantY
4DateAll
5RegionAll
6Product MappingAll
7StageAll
8Top 10/20/50/100 etc10
Sheet2






Excel 2007
LMNOPQ
1Top 10 Output with Subtotals
2NameDateRegionProduct MappingStageTotal
3ABC Ltd3-Dec-17CANFXMandate85
4ABC Ltd Total85
5Sony3-Oct-17APACLiqBid67
6Sony Total67
7Citi3-Dec-27LATAMLiqOpp65
8Citi Total65
9Infosys3-Oct-17CANFXClosed63
10Infosys Total63
11Cognizant3-Dec-17APACCCBid50
12Cognizant Total50
13Motorola3-Dec-17CANFXClosed34
14Motorola Total34
15LG10-Jul-18LATAMCCMandate27
16LG Total27
17Wipro3-Dec-17APACCCNQO23
18Wipro Total23
19Citi10-Jul-18LATAMCCMandate20
20Citi10-Jul-17EMEAFXOpp20
21Citi Total40
22Sony3-Dec-27LATAMLiqOpp20
23Sony Total20
24Ethihad3-Oct-17APACLiqBid19
25Ethihad Total19
26Samsung3-Oct-17CANFXClosed16
27Samsung Total16
28Barclays3-Dec-18LATAMLendLost15
29Barclays Total15
30Emirates3-Dec-17APACCCNQO14
31Emirates Total14
32Grand Total538
Sheet2



Column A - G is the Raw data
Column I - J is the filter criteria
Column L - Q is the final output based on the filtered criteria
I want to create a Macro which can givbe me the output (Column L - Q) in a new sheet based on filtered criteria (I - J)

What is Top 10?
Aggregate Revenue based on Name
Sorting sahould be Revenue i.e. Column G (Largest to Smallest), Name (A-Z), Stage (A-Z)
Adding subtotals


Please note that right now in the filter criteria I have only selected Relevant = Yes and Top 10
If I select multiple filter criteria i.e.Relevant = Yes and Date = 2017 & beyond and product = CC and Top 15, I should get the desired output based on selection criteria.

let me know if any further information is required.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Yes. This can be achieved with a Pivot table but i was thinking of a user form where i can select the filter criteria AND EXTRACT the data in a new sheet with defined formating.
 
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