Contact

EXPAND Function in LibreOffice Calc

Array LibreOffice Calc LibreOffice 25.8

Expand a LibreOffice Calc array to final dimensions, choose numeric or text padding, and distinguish default #N/A cells from original data.

Verification status: Eight ordinary INDEX-selected components, dimension or padding-check expressions were recalculated in LibreOfficeDev 26.8.0.0.alpha0 (2c87e51eeaa2b413ff4ae097b2705eea1995d8e5) using headless XLSX import and forced recalculation. Exact identities, typed results and controls were checked. LibreOffice 26.8.1.1 was source-reviewed only; stable 25.8 and GUI array entry were not executed. How formula examples are checked

Quick answer: =INDEX(EXPAND(H2:J3;3;4;0);3;4) returned 0 in the tested development build.

Availability and version history

  • Introduced: LibreOffice 25.8, explicitly stated in function-specific Help.
  • Supported in: 26.8 Help and 26.8.1.1 registration; no retirement is established.
  • Scope: Desktop Calc, English semicolon-separated formulas. Help identifies the COM.MICROSOFT.EXPAND namespace outside OpenFormula 1.3.
  • Checked: October 14, 2026. Eight listed component/dimension examples were recalculated in LibreOfficeDev 26.8.0.0.alpha0 using headless XLSX import. Stable 25.8, 26.8.1.1 and GUI array entry were not executed.

What EXPAND returns

EXPAND places an existing array at the top-left of a larger rectangle and fills newly added positions. Rows and Columns specify the final dimensions, not how many positions to append. Existing values are copied; the operation is not a resampling or repetition of the original data. Function Help.

Syntax and arguments

EXPAND(Array; Rows [; Columns [; Pad_with]])

Square brackets mark optional arguments; do not type them. Array is the source range or matrix. Rows gives the final height; Columns optionally gives the final width and otherwise keeps the existing width. An explicitly omitted Rows position retains the existing height in the inspected callback. Pad_with may be numeric or text; when absent, newly added cells contain #N/A.

For a whole-array result, the official Help instructs array-formula entry with Ctrl+Shift+Enter. The examples below instead select components with INDEX or inspect dimensions and padding. They do not establish a GUI spill or array-entry workflow.

Worksheet setup

Enter this source table in H2:J3:

Row H I J
2 1 2 3
3 4 5 6

Eight reproducible examples

The native column is from LibreOfficeDev 26.8.0.0.alpha0, build 2c87e51eeaa2b413ff4ae097b2705eea1995d8e5, using headless XLSX import and forced recalculation. TRUE is a Boolean result from the padding check, not an error value. Text is shown in quotes.

Formula Independent reference LibreOfficeDev result
=INDEX(EXPAND(H2:J3;3;4;0);3;4) 0 0
=INDEX(EXPAND(H2:J3;3;4;"pad");3;2) "pad" "pad"
=INDEX(EXPAND(H2:J3;3;4;0);2;3) 6 6
=ISNA(INDEX(EXPAND(H2:J3;3);3;1)) TRUE TRUE
=ROWS(EXPAND(H2:J3;4;5;0)) 4 4
=COLUMNS(EXPAND(H2:J3;4;5;0)) 5 5
=INDEX(EXPAND(H2:J3;2;3;"pad");1;2) 2 2
=INDEX(EXPAND(H2:J3;3;3;"");3;3) "" ""

Practical worksheet

The source H2:J3 has two rows and three columns. =EXPAND(H2:J3;3;4;0) makes a three-by-four rectangle with rows 1, 2, 3, 0; 4, 5, 6, 0; and 0, 0, 0, 0. The numeric zero is useful only when zero is a meaningful missing value for the next calculation. Use a visible text marker such as “pad” when the extension should remain distinguishable from genuine observations.

Advanced interpretation and checks

With m×n source cells and R×C final dimensions, the number of new positions is R×C−m×n. Expanding the example from 2×3 to 3×4 adds six positions, not just one row plus one cell. Default #N/A padding keeps the absence visible; =ISNA(INDEX(EXPAND(H2:J3;3);3;1)) checks one added position. An empty-string pad is text-like output, not a genuinely empty source cell, so later blank handling should be evaluated separately. Inspected implementation.

Boundaries and troubleshooting

Choose positive final dimensions at least as large as the source. EXPAND is not a shrinking function; TAKE is the relevant selection operation. The callback rejects ordinary smaller dimensions, but extreme and negative size conversions were not executed or certified. Padding changes downstream behavior: numeric zero, empty text and #N/A are different values. The examples check selected components and dimensions, not every possible formatting or visible-array entry workflow.

Official evidence and checking scope

All eight saved formula identities and their typed results were reconciled. The stale SUM cache changed to 3 and the uncached SUM returned 7. Imported _xlfn.EXPAND formulas were saved with the documented COM.MICROSOFT.EXPAND identity. These checks establish the listed development-build components only; current-source guards and unexecuted cases remain source-derived.

The empty-text example retains its saved formula and an empty result paragraph without a serialized value-type attribute. It is recorded as an empty formula result, distinct from the true blank source cells used by the flattening examples.