EXPAND in ONLYOFFICE Spreadsheet Editor
Expand an array to a larger rectangle with explicit padding, preserved positions, source-specific dimension behavior and reproducible small grids.
Verification status: See the evidence and test scope described in this guide. How formula examples are checked
Quick answer: With A1:B2 containing rows 10,20 and 30,40, =EXPAND(A1:B2,3,4,0) has a source-derived 3-row by 4-column result, preserving the original upper-left block and filling new cells with zero.
Availability and evidence scope
- Introduced: Original introduction release is not established by the checked sources.
- Available: Listed in current unversioned ONLYOFFICE help, checked October 18, 2026.
- Implementation inspected: Official SDKJS v10.0.0.169, commit
3679e0375a758d7dc59d31337a45461be3525ed8. The snapshot does not prove identical behavior in every installed editor. - Retired or deprecated: These sources do not establish retirement or formal deprecation.
- Testing: Numerical examples are independent mathematical expectations, and implementation discrepancies are labeled source predictions. No ONLYOFFICE application or calculation-engine execution was performed.
The examples use English function names and commas. Use your locale’s argument separator if different. Retain full precision in formulas; round only the displayed result. Nested output grids describe source-derived array contents. Native spill placement, obstruction errors, array-entry shortcuts and recalculation behavior have not been tested in the application. Reserve a separate output area and follow the array-formula entry method supported by your installed editor; do not assume a particular keyboard shortcut or automatic spill behavior.
Syntax and defaults
=EXPAND(array, rows, [columns], [pad_with])
Two to four argument slots are registered. array is the source, rows and columns are the requested total dimensions, and pad_with supplies the new cells. These are final dimensions, not counts to add. Omitted columns retain the original width. The default pad is the #N/A error value.
The documented empty rows slot preserves the original height when columns are supplied: =EXPAND(A1:B2,,4,0) describes width-only expansion. That empty slot differs from writing zero. A zero requested dimension is smaller than an ordinary nonempty input and is rejected by the inspected source. Use explicit positive integer dimensions for reproducible work.
EXPAND does not resize the worksheet, insert rows, repeat the original data, or stretch a chart. It constructs a new array while preserving each original element’s row and column position in the upper-left part of that array.
Step-by-step: pad a numeric block
- Enter 10 in A1, 20 in B1, 30 in A2 and 40 in B2.
- Keep an independent 3-by-4 output area free of source data.
- Enter
=EXPAND(A1:B2,3,4,0)using your editor’s supported array-formula workflow. - Compare the intended result with this source-derived grid:
| Output row | Column 1 | Column 2 | Column 3 | Column 4 |
|---|---|---|---|---|
| 1 | 10 | 20 | 0 | 0 |
| 2 | 30 | 40 | 0 | 0 |
| 3 | 0 | 0 | 0 | 0 |
The independent construction is simple: keep a source element only when its row is below 2 and its column is below 2; otherwise insert the pad. There are 12 output positions, 4 original values and 8 padded positions. Their sum is still 100 because zero padding adds no numeric total.
If you instead use =EXPAND(A1:B2,3), width stays at 2 and the third row contains two source-predicted #N/A values. Those are error values, not the text “#N/A.” Aggregations may propagate them rather than ignoring them.
Advanced example: align differently sized numeric blocks
A downstream calculation may require all input blocks to have the same dimensions. Expanding a 2-by-2 block to a 3-by-4 target with zero padding can preserve totals while making the dimensions explicit. Check source dimensions first with ROWS and COLUMNS, and record the intended target size beside the formula.
The pad has a meaning: zero says “additive contribution of zero,” whereas "" is an empty text string and default #N/A marks unavailable data. An empty string is not a physically empty cell, and zero is not an unknown observation. Choose the pad based on the later calculation rather than just how the grid looks.
If the source is already the target size, EXPAND returns the same grid contents. If the source is larger than the target in either direction, use a selection method instead; EXPAND does not crop. This makes it useful for standardizing dimensions but not for truncating records.
Source-specific dimensions and errors
The inspected implementation rejects target rows or columns smaller than the input with internal wrong_value_type, conventionally #VALUE!. For this dataset, =EXPAND(A1:B2,1,2) predicts that error. A requested product of rows times columns greater than 1,048,576 predicts internal not_numeric (#NUM!). This code threshold does not guarantee a grid can be placed anywhere on a worksheet.
Dimensions are converted to numbers but are not truncated before the loops. A requested 2.5 rows with width 2 therefore produces three loop iterations in the inspected source: =EXPAND(A1:B2,2.5,2,0) predicts three rows. Do not rely on fractional dimensions; the pre-loop size check also uses the unrounded product. Integer input avoids this inconsistency.
A range or array supplied as pad_with is rejected by the inspected code; use a scalar pad. Rows or columns supplied as multi-cell ranges are also explicitly rejected there, while arrays used for dimensions select their first element. Empty scalar source inputs are rejected, but blanks within a valid source range are retained as elements. Their native displayed appearance is not established here.
This is a layout transformation, not a test that a missing value is validly replaced. Preserve a copy of the original block when the distinction between original and padded positions matters.
Compatibility and related functions
Recalculate representative formulas when moving a workbook between editors. Matching names do not guarantee identical argument coercion, array behavior, numerical precision or error handling. These source-derived examples do not establish automatic spill behavior or a general import/export guarantee.
Official references
- ONLYOFFICE EXPAND help, checked October 18, 2026.
- Official SDKJS implementation, 1079–1205, tag v10.0.0.169 and exact commit above.