CHOOSEROWS Function (LibreOffice Calc)
The CHOOSEROWS function returns specific rows from an array or range. It is used for dynamic row extraction, array reshaping, and building flexible filtering and lookup workflows.
Compatibility
▾| Excel | ✔ |
| Gnumeric | ✖ |
| Google_sheets | ✖ |
| Libreoffice | ✔ |
| Numbers | ✖ |
| Onlyoffice | ✔ |
| Openoffice | ✖ |
| Wps | ✔ |
| Zoho | ✖ |
What the CHOOSEROWS Function Does ▾
- Returns selected rows from a range or array
- Supports multiple row indexes
- Works with dynamic arrays
- Useful for filtering, reshaping, and lookup preparation
- A modern alternative to INDEX‑based row extraction
Syntax ▾
CHOOSEROWS(array; row1; row2; row3; ...)
Arguments
-
array:
The source range or array. -
row1, row2, …:
One or more row numbers to extract (1‑based).
Basic Examples ▾
Extract a single row
=CHOOSEROWS(A1:D10; 3)
→ returns row 3
Extract multiple rows
=CHOOSEROWS(A1:D10; 1; 10)
→ returns rows 1 and 10
Using cell references
=CHOOSEROWS(A1:D10; A12)
Advanced Examples ▾
Reorder rows
=CHOOSEROWS(A1:D10; 10; 1; 5)
→ row 10, row 1, row 5
Combine with FILTER
=CHOOSEROWS(FILTER(A1:D100; A1:A100>0); 1; 5; 10)
Combine with SORTBY
=SORTBY(CHOOSEROWS(A1:D100; 1; 3; 7); 2; -1)
Dynamic selection using MATCH
=CHOOSEROWS(A1:D10; MATCH("Total"; A1:A10; 0))
Extract every second row
=CHOOSEROWS(A1:D20; {1;3;5;7;9})
Use with XLOOKUP to return multiple rows
=XLOOKUP(E1; A1:A100; CHOOSEROWS(A1:D100; 2; 4))
Edge Cases and Behavior Details ▾
CHOOSEROWS is 1‑based
- Row 1 = first row
- Row 0 → Err:502
- Negative indexes → Err:502
Accepts:
- Ranges
- Dynamic arrays
- Array literals
Behavior details
- Returns a dynamic array
- Row order is preserved based on the argument order
- Duplicate row indexes are allowed
- Out‑of‑range indexes → Err:502
CHOOSEROWS of an error → error propagates
Common Errors and Fixes ▾
Err:502 — Invalid argument
Cause:
- Row index < 1
- Row index > number of rows
- Non-numeric index
Fix:
- Validate row numbers
- Use MATCH to generate safe indexes
#VALUE! or #REF! in downstream formulas
Cause:
- Array size mismatch
Fix:
- Wrap with IFERROR or validate array dimensions
Best Practices ▾
- Use CHOOSEROWS for clean, readable row extraction
- Use INDEX for column‑based extraction
- Combine with FILTER, SORT, and SORTBY for dynamic pipelines
- Use MATCH to generate row indexes programmatically
- Use CHOOSECOLS for column extraction
CHOOSEROWS is perfect for reshaping data — especially when building dynamic dashboards, lookup tables, or filtered views.
Related Patterns and Alternatives ▾
- CHOOSECOLS — extract columns
- CHOOSE — select from a list
- INDEX — flexible row/column extraction
- FILTER — row filtering
- SORT / SORTBY — ordering arrays
- XLOOKUP — modern lookup with array returns
By mastering CHOOSEROWS, you can build powerful, dynamic data‑manipulation workflows in LibreOffice Calc.