CHOOSECOLS Function (LibreOffice Calc)

Lookup & Reference Intermediate LibreOffice Calc Introduced in LibreOffice 7.4
arrays dynamic-arrays lookup reference column-selection data-manipulation

The CHOOSECOLS function returns specific columns from an array or range. It is used for dynamic column extraction, array reshaping, and building flexible lookup and filtering workflows.

Compatibility

What the CHOOSECOLS Function Does

  • Returns selected columns from a range or array
  • Supports multiple column indexes
  • Works with dynamic arrays
  • Useful for filtering, reshaping, and lookup preparation
  • A modern alternative to INDEX‑based column extraction

Syntax

CHOOSECOLS(array; col1; col2; col3; ...)

Arguments

  • array:
    The source range or array.

  • col1, col2, …:
    One or more column numbers to extract (1‑based).

Basic Examples

Extract a single column

=CHOOSECOLS(A1:D10; 2)
→ returns column B

Extract multiple columns

=CHOOSECOLS(A1:D10; 1; 4)
→ returns columns A and D

Using cell references

=CHOOSECOLS(A1:D10; A12)

Advanced Examples

Reorder columns

=CHOOSECOLS(A1:D10; 4; 1; 2)
→ D, A, B

Combine with FILTER

=CHOOSECOLS(FILTER(A1:D100; A1:A100>0); 1; 3)

Combine with SORTBY

=SORTBY(CHOOSECOLS(A1:D100; 1; 4); 2; -1)

Dynamic selection using MATCH

=CHOOSECOLS(A1:D10; MATCH("Price"; A1:D1; 0))

Extract every second column

=CHOOSECOLS(A1:H10; {1;3;5;7})

Use with XLOOKUP to return multiple columns

=XLOOKUP(E1; A1:A100; CHOOSECOLS(A1:D100; 2; 4))

Edge Cases and Behavior Details

CHOOSECOLS is 1‑based

  • Column 1 = first column
  • Column 0 → Err:502
  • Negative indexes → Err:502

Accepts:

  • Ranges
  • Dynamic arrays
  • Array literals

Behavior details

  • Returns a dynamic array
  • Column order is preserved based on the argument order
  • Duplicate column indexes are allowed
  • Out‑of‑range indexes → Err:502

CHOOSECOLS of an error → error propagates

Common Errors and Fixes

Err:502 — Invalid argument

Cause:

  • Column index < 1
  • Column index > number of columns
  • Non-numeric index

Fix:

  • Validate column 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 CHOOSECOLS for clean, readable column extraction
  • Use INDEX for row‑based extraction
  • Combine with FILTER, SORT, and SORTBY for dynamic pipelines
  • Use MATCH to generate column indexes programmatically
  • Use CHOOSEROWS for row extraction
CHOOSECOLS is perfect for reshaping data — especially when building dynamic dashboards, lookup tables, or filtered views.

Related Patterns and Alternatives

  • CHOOSEROWS — extract rows
  • 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 CHOOSECOLS, you can build powerful, dynamic data‑manipulation workflows in LibreOffice Calc.

Copyright 2026. All rights reserved.