The SORTN function in Google Sheets sorts your data and returns the first n results.
One common use case is to find the top n or the bottom n values in a dataset.
For example, here’s how you use SORTN to extract the top 5 values in a dataset:
with this formula:
=SORTN(A2:C21,5,0,3,FALSE)
🔗 Get this example and others in the template at the bottom of this article.