Filter Top 5 of Filtered Data

fisheyecream

New Member
Joined
Jun 20, 2013
Messages
2
Hi!

I have been trying to retrieve the top 5 entries by revenue after filtering using an industry category. The problem I'm facing is that the top 5 filter seems to assume that I want the data that is not captured by the first filter so I am left with "missing" data which is supposed to actually be caught by the top 5 filter.

Some background: I am trying to write a macro which captures the top 5 industries based on revenue, then copy and paste visible rows into another worksheet. I have managed everything except the top 5 filter. I hope someone can help! Thanks in advance!
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Hi and welcome to the Board!

One possible solution is to copy the filtered data to another location and filter again:

Code:
Sub Filter_filtered_data()
'original table at a1:d35, already filtered by industry


' criteria for top five filtering
Range("o1").Value = ""
Range("o2").FormulaR1C1 = "=RC[-2]>=LARGE(R2C13:R35C13,5)"


' copy filtered data
Range("A1:D35").SpecialCells(xlCellTypeVisible).Copy Destination:=Range("j1")


' apply top five filter
Range("j1:m35").AdvancedFilter Action:=1, CriteriaRange:=Range("o1:o2"), Unique:=False


End Sub
 
Upvote 0
Hi worf,

Thanks! That was what I thought too but wasn't sure if there was any other more efficient method of doing so. thanks for your help nevertheless, looks like i'm going to go ahead with the method you suggested!
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

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