SORTN
The first n rows of a range after sorting.
- Excel: No equivalent
- Google Sheets: Not checked yet
- Returns: Array
Examples
=SORTN(A1:A5, 2) | A | |
|---|---|
| 1 | 10 |
| 2 | 20 |
| 3 | 30 |
| 4 | 40 |
| 5 | 50 |
Result 10
Syntax
SORTN(range, [n], [display_ties_mode], [sort_column], [is_ascending]) range- range required
n- number optional defaults to
1 display_ties_mode- number optional
sort_column- number optional defaults to
1 is_ascending- boolean optional defaults to
1
Related
ARRAY_CONSTRAINTruncates a range to at most the given rows and columns. ARRAYFORMULAEvaluates an expression across a range (this engine already spills, so it is a pass-through for sheets compatibility). ARRAYTOTEXTConverts array to text representation. BYCOLApplies lambda to each column of array. BYROWApplies lambda to each row of array. CHOOSECOLSReturns the specified columns from an array.