Formualizer Docs

CHOOSEROWS

Returns selected rows from an array or range.

CHOOSEROWS builds a new spilled array containing only the requested rows, in the order provided.

The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.

Syntax

=CHOOSEROWS(array, row_num1, [row_num2], ...)

Arguments

ArgumentTypeRequiredDefault
arrayrange or any (range)Required—
row_num1numberRequired—
row_num2valueOptional—

Accepts a variable number of arguments. Minimum: 2.

Remarks

  • Row indexes are 1-based; negative indexes count from the end (-1 is last row).
  • Repeated indexes are allowed and duplicate rows in the output.
  • The result spills as an array unless it collapses to a single cell.

Error cases

  • Index 0 or out-of-bounds indexes return #VALUE!.

Examples

Select the middle row from a three-row array.

Formula =CHOOSEROWS({1,2;3,4;5,6},2)

Expected result {3, 4}

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Use a negative index to select the last row before the first.

Formula =CHOOSEROWS({1,2;3,4;5,6},-1,1)

Expected result {5, 6; 1, 2}

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

A one-cell array has a first row.

Formula =CHOOSEROWS({7},1)

Expected result 7

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

A row index outside the array cannot be selected.

Formula =CHOOSEROWS({1,2;3,4;5,6},4)

Expected result #VALUE!

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Pick first and last rows

Formula =CHOOSEROWS(A1:A3,1,-1)

Input cells
A
1"Jan"
2"Feb"
3"Mar"

Expected result {"Jan"; "Mar"}

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Duplicate a row in output

Formula =CHOOSEROWS(A1:A2,2,2)

Input cells
A
15
29

Expected result {9; 9}

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

FAQ

Can I return rows in a custom order?

Yes. CHOOSEROWS returns rows in the exact order of the supplied indexes, and repeated indexes duplicate rows.

When does CHOOSEROWS return #VALUE!?

It returns #VALUE! for index 0 and for row indexes outside the source height after applying negative-index conversion.

Implementation

Engine source

On this page