CHOOSEROWS function
CHOOSEROWS returns specific rows of an array in the order you list them, such as the first and last rows, as a new array. A row number of -1 grabs the last row.
Example
Read it as a sentence: from B1:E7 return only the 1st and 3rd rows, the header row and the Briar pipe row.
Syntax
CHOOSEROWS(array, row_num1, [row_num2], ...)
Arguments in [square brackets] are optional.
-
array(required) - Source array or range.
-
row_num1(required) - Row number to return; negative counts from the bottom.
-
row_num2(optional) - More rows to return, in the order given.
Returns: The chosen rows as a new array.
One CHOOSEROWS formula can fill more than one cell. When the result has several values, they spill into the cells below or to the right of the formula.
What Excel actually returns
Each formula below was run in desktop Excel. The result is exactly what the cell showed, errors included.
| Formula | Excel shows | Case |
|---|---|---|
=CHOOSEROWS({1;2;3},{3;1}) | 3 | Array of indexes |
=CHOOSEROWS(Items!B1:E7,1,3) | Item | Two rows |
=CHOOSEROWS(Items!B1:E7,-1) | Commonplace book | Last row |
=CHOOSEROWS(Items!B1:C3,"2") | Boxer cartridge | Text index |
=CHOOSEROWS(Items!B1:E7,8) | #VALUE! | Past last row |
=CHOOSEROWS(Items!B1:E7,0) | #VALUE! | Zero |
The Items sheet these formulas read
Watch out for
- #VALUE! if a row number is 0 or out of range.
- Use -1 to grab the last row.
Where it works
- Excel
- CHOOSEROWS arrived in Excel 2024. Older versions do not have it. 365, Excel for the web and Excel 2024; not in older perpetual versions.
- Google Sheets
- Same name, same behaviour for everyday use.
Part of Lookup and reference functions. Every result on this page was measured in desktop Excel, build 16.0.20527. Last updated .