EXPAND makes an array bigger. It keeps your values where they are and adds rows and columns to reach the size you ask for, filling the new cells with a value you choose. It is a small function, and it solves one specific problem: getting arrays to the same shape.
The arguments
- array is what you start with.
- rows is the total height you want, not the number of rows to add. A 2-row array expanded to 4 rows gets two new rows.
- columns is the total width, in the same way. Leave it out to keep the original width.
- pad_with is the fill. The default is
#N/A, which makes it obvious that the cell was added. Use 0 for numbers or "" for empty-looking cells.
=EXPAND(A2:B3,4,3,0) turns a 2-by-2 block into a 4-by-3 block and fills the new cells with zeros.
You can only grow, not shrink
If the size you ask for is smaller than the array, EXPAND returns #VALUE!. To make an array smaller, use TAKE or DROP. If you aren't sure whether the array is smaller than the target, wrap the target in MAX: EXPAND(A2:B3,MAX(4,ROWS(A2:B3))).
Why you need it
The stacking functions pad mismatched arrays with #N/A by themselves, but only with that value, and you can't choose it. EXPAND lets you pad an array before you stack it, with the fill you want:
=VSTACK(A2:B3,EXPAND(D2:D3,,2,""))
Here the second block has one column and the first has two. EXPAND widens it to two columns with an empty-text fill, so the stacked result has no #N/A in it.
Matching the size of another block
To make one array the same size as another, take the dimensions from the other: =EXPAND(A2:B3,ROWS(D2:E6),COLUMNS(D2:E6),0) pads a small table to the size of a bigger one with zeros. That is useful before adding two tables cell by cell, because arithmetic on arrays of different sizes produces #N/A in the extra cells.
Padding a grid for display
EXPAND is also an easy way to draw a fixed-size grid, such as a template with 10 rows where only the first few have data: =EXPAND(FILTER(A2:B20,A2:A20<>""),10,,""). (If FILTER returns more than 10 rows, EXPAND returns #VALUE!, so check the sizes.)
Notes
The result spills down and to the right. If the cells it needs aren't empty, you get #SPILL!. See FILTER for spill ranges and the # operator.
EXPAND needs Microsoft 365, Excel 2024 or later, or Excel for the web.