Arrayhard

SORTN()

Returns the first n items of a sorted range, for top-N or bottom-N selection.

Syntax
fx
=SORTN(range, [n], [display_ties_mode], [sort_column], [is_ascending])
Arguments
ArgumentDescription
rangeThe range or array to sort.
[n]The number of items to return. Defaults to 1.
[display_ties_mode]0 = strict ranking, 1 = show duplicate ties, 2 = show first tied, 3 = show all ties.
[sort_column]The column index to sort by.
[is_ascending]TRUE for ascending (smallest n returned), FALSE for descending.
Example
fx
=SORTN(A2:B100, 5, 0, 2, FALSE)

Paste this into Google Sheets to run it. The live playground on this site covers 24 of the 61 functions, and SORTN isn't one of them yet.

Related formulas
SORT()
Sorts the rows of a range by values in one or more columns.
FILTER()
Returns a filtered version of the source range, returning only rows or columns which meet the conditions.
Used by
SORT()
Sorts the rows of a range by values in one or more columns.