Contact

Numbers EXPAND: Add Rows, Columns and Padding to an Array

Reference Intermediate Apple Numbers

Enlarge Numbers arrays with EXPAND, distinguish original blanks from new padding and check omitted dimensions, totals and averages step by step.

Verification status: See the evidence and test scope described in this guide. How formula examples are checked

EXPAND enlarges an array to a requested row and column count, filling the new positions with a chosen value. It preserves the original arrangement; it does not repeat the data or stretch it proportionally.

A key distinction is where a value comes from. Apple says an empty cell inside the original array becomes 0, while newly added cells use pad-with.

Availability and version history

  • Introduced: The original introduction release and date are not established by the checked references.
  • Availability: Currently documented in Apple’s Functions Help 15.4 documentation edition; no final supported-version endpoint is established.
  • Scope: Shared iWork reference. Function-specific historical Mac, iPad, iPhone and iCloud endpoints are unverified.
  • Checked: October 14, 2026, against the official EXPAND reference. Examples were independently calculated; no native Numbers test was performed.

Syntax, dimensions and padding

EXPAND(array, number-of-rows, number-of-columns, pad-with)

The official EXPAND reference gives these rules:

  • array is the original array to enlarge.
  • Omitting a requested row or column count keeps that original dimension.
  • A requested dimension smaller than the corresponding original dimension causes an error; EXPAND does not crop the input.
  • pad-with supplies the new cells. Omitting it produces an error in padded cells, not a default zero.
  • Put nonnumeric padding, such as "-", in quotation marks.

The exercises use positive integer dimensions. Fractional counts, extreme sizes and precise runtime error tokens are not established here.

See original blanks, real zeros and added cells separately

Create PaddedGrid, with twelve columns A:L and fourteen rows, using no header rows. Enter this source grid in B2:D3:

Row B C D
2 8 Leave empty 0
3 5 12 9

Leave C2 genuinely empty. D2 must contain numeric zero. Put row indices 1,2,3 in F3:F5 and column indices 1,2,3,4 in G2:J2.

In G3 enter:

=INDEX(EXPAND($B$2:$D$3,3,4,"-"),$F3,G$2)

Fill across through J3, then fill G3:J3 down through row 5. The extracted 3×4 result is:

Output row G H I J
3 8 0 0 -
4 5 12 9 -
5 - - - -

The first zero in H3 came from the original blank C2. The zero in I3 came from the genuine numeric zero D2. Both become the same numeric output, even though the original inputs have different meanings. The six newly added positions contain the text dash.

Use G7:G10 for four explicit position checks, with labels in F:

Cell Formula Expected result
G7 =INDEX(EXPAND(B2:D3,3,4,"-"),1,2) 0
G8 =INDEX(EXPAND(B2:D3,3,4,"-"),1,3) 0
G9 =INDEX(EXPAND(B2:D3,3,4,"-"),1,4) Text dash
G10 =INDEX(EXPAND(B2:D3,3,4,"-"),3,1) Text dash

A dash is a chosen presentation marker, not a numeric measurement or evidence that the missing quantity equals zero.

Advanced: zero padding preserves a total but changes a mean

Make a copy named ZeroPadding. Replace G3 with =INDEX(EXPAND($B$2:$D$3,3,4,0),$F3,G$2), fill through J3, then down through row 5. Clear the old G7:G10 position checks because their text-padding formulas belong to the first scenario.

The output becomes 8,0,0,0 in row 3, 5,12,9,0 in row 4 and four zeros in row 5. In L3 enter =SUM(G3:J3) and fill through L5 for 8,26,0.

Cell Formula Expected result
L7 =SUM(G3:J5) 34
L8 =SUM(B2:D3) 34
L9 =L7-L8 0
L11 =AVERAGE(G3:J5) 2.8333333333 approximately
L12 =AVERAGE(B2:D3) 6.8

There are twelve numeric outputs after expansion, including the zero-filled blank and six new zero pads. The original range has five numeric values, with its genuine blank excluded from AVERAGE. Thus 34/12 differs from 34/5 although the totals agree.

Use SUM and AVERAGE deliberately: zero padding is suitable only when those zeros have the intended meaning in later calculations. It is not a neutral way to complete missing measurements.

Omit one dimension without shifting the padding argument

Create RowsOnly, with ten columns A:J and eight rows, using no header rows. Enter 1,2,3 in A1:C1 and 4,5,6 in A2:C2. Put row indices 1,2,3 in E2:E4 and column indices 1,2,3 in F1:H1.

In F2 enter =INDEX(EXPAND($A$1:$C$2,3,,"-"),$E2,F$1), fill through H2 and then down through row 4. Expect rows 1,2,3, 4,5,6 and -,-,-.

The empty third argument between the two commas deliberately omits the column count; the fourth argument is still the padding string. The width remains three. Replacing that omission with an arbitrary zero would be a different request.

Apple’s published illustration uses the same pattern on a larger range: EXPAND(A1:E5,6,,"-") adds one row while retaining five columns. Its other example, EXPAND(A1:E5,6,6,0), adds both a row and a column with zero padding. Apple supplies those shape examples without a numerical input grid, so the worksheets above provide their own fully specified data.

Errors, shrinking and interpretation

Requesting only one row for the two-row source is documented to produce an error. If you need to select or remove rows, choose a function designed for that task rather than treating EXPAND as a crop operation.

An omitted padding value is also distinct from explicit zero or text: newly created cells contain errors. The checked entry does not name their exact token. It also reports an error for arrays that are too large without giving a numeric limit. Retain those distinctions when porting a workbook from software with different padding conventions.

Array layout and practical limits

These worksheets use INDEX to extract individual array elements into specified cells. Apple documents INDEX as accepting an array returned by another function. This makes each expected position explicit; it is not an observed automatic-spill demonstration.

The function references also permit the spilled-range operator #. Exact native spill placement, maximum array size, imported-workbook behavior and error tokens have not been measured here. Keep input cells separate from result cells, and do not extend an INDEX formula beyond the expected result dimensions.

English formulas use commas between arguments and decimal points. Apple’s functions overview specifies semicolon argument separators when the decimal separator is a comma. Check the target document’s conventions before copying a formula.

TOCOL and TOROW flatten arrays rather than enlarging their rectangular shape.