Function · Shape arrays

Excel EXPAND function

The Excel EXPAND function pads an array out to a set size. A $2,100 and $860 row widened to 3 columns with 0 is $2,100, $860, and 0.

Microsoft 365, Excel 2024, and Excel for the web. Also in Google Sheets. Excel 2021 and Excel 2019 return #NAME?.

Syntax =EXPAND(array, rows, [columns], [pad_with])

EXPAND
=EXPAND(B3:C3,1,3,0)

Arguments

NameRequiredWhat to pass
arrayRequiredThe array to grow. The original values stay in the top-left of the result.
rowsOptionalHow many rows the result should have. Leave it out and the result keeps the array's row count. A count smaller than the array is #VALUE!.
columnsOptionalHow many columns the result should have. Leave it out and the result keeps the array's column count. A count smaller than the array is #VALUE!.
pad_withOptionalThe value written into the new cells. Leave it out and those cells are #N/A. Pass 0 or an empty string when a sum should ignore the pad.

Examples

Two store rows of different widths, stacked with a 0 pad

=VSTACK(B2:D2,EXPAND(B3:C3,1,3,0))

Result $1,250, $980, $1,475, then $2,100, $860, and 0

The default pad is

=EXPAND(B3:C3,1,3)

Result $2,100, $860, #N/A

A one-row header grown into a three-row block

=EXPAND(A1:D1,3,4,"")

Result Store, 3/2/2026, 3/3/2026, 3/4/2026, then two blank rows

=VSTACK(B2:D2,EXPAND(B3:C3,1,3,0))B5
Stores
ABCD
1Store3/2/20263/3/20263/4/2026
2Austin12509801475
3Dallas2100860
4
5Stack12509801475
621008600
A picture of the sheet, not a live calculator. B5 holds the formula, and C5:D6 is the spill. D6 is the 0 pad. This result needs Microsoft 365, Excel 2024, or Excel for the web.

EXPAND pads an array out to the number of rows and columns you set. The original values stay in the top-left. Extra cells take pad_with. Leave that argument out and the pad is #N/A. Leave rows out and the result keeps the array’s row count. Leave columns out and it keeps the array’s column count. The spill needs Microsoft 365, Excel 2024, or Excel for the web.

The week of 3/2/2026 has two stores. Austin, in B2:D2, sold $1,250 on 3/2/2026, $980 on 3/3/2026, and $1,475 on 3/4/2026. Dallas, in B3:C3, sold $2,100 on 3/2/2026 and $860 on 3/3/2026. VSTACK of those two rows pads the short row with #N/A, so the block is $1,250, $980, $1,475 and then $2,100, $860, #N/A. SUM of that block is #N/A. =VSTACK(B2:D2,EXPAND(B3:C3,1,3,0)) widens Dallas with 0 first. The stack is $1,250, $980, $1,475 and then $2,100, $860, 0. Austin sums to $3,705. Dallas sums to $2,960. The six numbers sum to $6,665. =EXPAND(B3:C3,1,3,0) by itself is $2,100, $860, and 0. HSTACK has the same #N/A pad when two arrays have different heights. Expand the short one to the taller height before you place them side by side.

=EXPAND(B3:C3,1,3) is $2,100, $860, and #N/A. The formula spills. The #N/A is the pad, the same default WRAPROWS uses for a short last row and WRAPCOLS uses for a short last column. =EXPAND(B3:C3,1,3,"") puts an empty string in the third cell. SUM of those three cells is $2,960 with the 0 pad, and $2,960 with the empty string. SUM of the three cells is #N/A when the pad is #N/A. IFNA of the default spill, with 0, returns the same $2,100, $860, and 0.

A header in A1:D1 reads Store, 3/2/2026, 3/3/2026, and 3/4/2026. =EXPAND(A1:D1,3,4,"") spills that header and two blank rows, a block of 3 rows by 4 columns. Eight cells are the empty-string pad. Leave the pad out and those eight cells are #N/A. =EXPAND(A1:D1,3,,"") leaves columns out, keeps the four header columns, and returns the same block. A one-row header next to a taller array is the unequal-height case HSTACK pads with #N/A. Expand the header to that height first.

Microsoft’s sample expands the 2 by 2 block 1, 2 / 3, 4 to 3 rows and 3 columns. The result is 1, 2, #N/A, then 3, 4, #N/A, then a row of three #N/A cells. Expanding the single cell 1 to 3 by 3 with a pad of “-” puts 1 in the corner and “-” in the other eight cells.

TAKE and DROP keep or remove an edge. CHOOSEROWS and CHOOSECOLS pick rows and columns by number. TOCOL unwinds a block into one column. SEQUENCE spills a run of numbers. A rows or columns count smaller than the array is #VALUE!. =EXPAND(B2:D2,1,2) asks for 2 columns of Austin’s 3-day row and returns #VALUE!. More than 1,048,576 rows, or more than 16,384 columns, is past the worksheet grid, and that size is #NUM!. A filled cell in the spill is #SPILL!. Excel 2021 and Excel 2019 return #NAME?. Google Sheets has EXPAND, and its default pad is #N/A too.