This Excel macro filters data in Excel in order to display the top 10 items from the data set. The macro uses the autofilter feature and xltop10items operator in Excel. The top 10 items from a list applies to number formatting in Excel and means the top ten highest values or numbers within the list.
This is a good way to narrow down results in Excel in order to better analyze large sets of data. To use the macro you only need to update the field and range numbers and apply them to your data set in Excel.
All of the elements below often appear within autofilter macros.
Range
Field
Criteria
Operator
Sub AutoFilter_Top_10_Items()
Range("A1").AutoFilter Field:=1, Criteria1:="10", Operator:=xlTop10Items
End Sub