SheetRocks
Documentation/Formulas/LAST

LAST

Returns the last N rows and optionally last N columns from an array. Returns an error if the result would be empty.

Syntax

LAST(array, n_rows, [n_columns])

Arguments

Argument Description Required
array The array from which to take elements. Required
n_rows The number of rows to take from the end. Required
n_columns The number of columns to take from the end. If not specified, all columns are included. Optional

Examples

Take last 2 rows from array

=LAST(A1:C3, 2)
Result ⇒ Array: [["John","25","85"], ["Jane","30","92"]]
A B C
1 Name Age Score
2 John 25 85
3 Jane 30 92

Take last 2 rows and last 2 columns

=LAST(A1:C3, 2, 2)
Result ⇒ Array: [["25","85"], ["30","92"]]
A B C
1 Name Age Score
2 John 25 85
3 Jane 30 92

Take last 2 columns from single row

=LAST(A1:D1, 1, 2)
Result ⇒ Array: [["Cherry","Date"]]
A B C D
1 Apple Banana Cherry Date

Related Functions

Other Data functions:


← Back to Formula Reference