Going Stellar

Home/Google Sheets reference

Google Sheets function · Array

CHOOSEROWS in Google Sheets: syntax and examples

CHOOSEROWS builds a new array from the rows you name, in the order you name them. It can reorder, repeat or pick from the end, which a plain range reference cannot.

Syntax

CHOOSEROWS(array, row_num1, [row_num2])

Arguments

ArgumentTypeRequiredWhat it does
arrayrangeyesThe range or array to take rows from.
row_num1numberyesThe first row to return. Negative numbers count from the bottom.
row_num2, ...numbernoMore rows to return, in the order you list them.

Examples

The examples use this table, starting in A1:

NameCityQty
AnaCluj3
DanIasi5
MiaSibiu2
EvaBrasov7
=CHOOSEROWS(A1:C5,1,3)

Result:

NameCityQty
DanIasi5

Rows 1 and 3 of the range: the header and the second record.

Run in a Google Sheet (English US locale) on .

=CHOOSEROWS(A1:C5,-1)

Result:

EvaBrasov7

A negative number counts from the end, so -1 is the last row.

Run in a Google Sheet (English US locale) on .

=CHOOSEROWS(A2:C5,3,1)

Result:

MiaSibiu2
AnaCluj3

The order you type is the order you get: row 3 first, then row 1.

Run in a Google Sheet (English US locale) on .

=CHOOSEROWS(A2:C5,{1;3})

Result:

AnaCluj3
MiaSibiu2

Row numbers can come from a typed array instead of separate arguments.

Run in a Google Sheet (English US locale) on .

=CHOOSEROWS(SORT(A2:C5,3,FALSE),1,2)

Result:

EvaBrasov7
DanIasi5

Sort by quantity, then keep the top two rows.

Run in a Google Sheet (English US locale) on .

Common errors

  • Row 0 and rows beyond the range return #VALUE!. A range of five rows accepts 1 to 5 and -1 to -5.
  • Rows come back in the order you list them, not in sheet order, so CHOOSEROWS(A2:C5,3,1) starts with row 3.
  • The same row can be listed twice and then appears twice in the result.
  • It picks by position, not by value. To keep rows that meet a condition, use FILTER.

Compared with Excel

Same function and arguments as Excel 365 CHOOSEROWS.

Sources

  1. CHOOSEROWS (Docs Editors Help)

Markdown version · All functions