Functions
SORTN
Return top N rows of an array sorted
Try it
When to use it
When do I use SORTN instead of SORT or LARGE?
Use SORTN when you want only the top N rows of an array in sorted order; SORT returns all rows sorted, while LARGE returns a single scalar value.
Used in
Syntax
SORTN(array, [n], [display_ties_mode], ...)Examples
=SORTN({5,3,1,4,2},1) // => 5
=SORTN({5,3,1,4,2},2) // => 5
=SORTN({10,20,10,30,20},3,0) // => 10