Function · Shape arrays
Excel WRAPCOLS function
The Excel WRAPCOLS function spills one list down columns. Six amounts in columns of 3 are $1,250, $980, $1,475, then $2,100, $860, $1,640.
Syntax =WRAPCOLS(vector, wrap_count, [pad_with])
=WRAPCOLS(A2:A9,3)Arguments
| Name | Required | What to pass |
|---|---|---|
| vector | Required | One row or one column to wrap. A block with more than one row and more than one column is #VALUE!. |
| wrap_count | Required | How many values each result column holds. A wrap_count below 1 is #NUM!. A wrap_count at least as large as the list returns the list as one column. |
| pad_with | Optional | The value used to fill a short last column. Leave it out and the pad is #N/A. |
Examples
Eight territories, three to a column
=WRAPCOLS(A2:A9,3)Result First column Austin, Dallas, Houston. Second column San Antonio, Fort Worth, El Paso. Third column Plano, Arlington, #N/A.
Six invoice amounts that fill two columns exactly
=WRAPCOLS(B2:B7,3)Result First column $1,250, $980, $1,475. Second column $2,100, $860, $1,640.
Five March amounts, padded with 0
=WRAPCOLS(B2:B6,3,0)Result First column $420, $315, $180. Second column $95, $260, and 0.
Seven Monday totals, wrapped from a row
=WRAPCOLS(B2:H2,3)Result First column $4,200, $3,150, $5,100. Second column $2,800, $6,400, $3,900. Third column $4,750, #N/A, #N/A.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Rep | City | ||||
| 2 | Austin | Austin | San Antonio | Plano | ||
| 3 | Dallas | Dallas | Fort Worth | Arlington | ||
| 4 | Houston | Houston | El Paso | #N/A | ||
| 5 | San Antonio | |||||
| 6 | Fort Worth | |||||
| 7 | El Paso | |||||
| 8 | Plano | |||||
| 9 | Arlington |
WRAPCOLS spills a single row or a single column into a grid, filling down each column. wrap_count is the number of values in each column. A short last column is filled with pad_with. Leave that argument out and the pad is #N/A. The spill needs Microsoft 365, Excel 2024, or Excel for the web.
Eight territories sit in A2:A9: Austin, Dallas, Houston, San Antonio, Fort Worth, El Paso, Plano, and Arlington. =WRAPCOLS(A2:A9,3) spills Austin, Dallas, Houston down the first column, San Antonio, Fort Worth, El Paso down the second, and Plano, Arlington, #N/A down the third. The first row of that spill is Austin, San Antonio, and Plano. CHOOSEROWS of the spill, row 1, returns those three names. IFNA of the spill, with an empty string, puts a blank in the last cell. WRAPROWS of the same list, with the same 3, fills across instead, so its first row is Austin, Dallas, Houston.
Six invoice amounts, $1,250, $980, $1,475, $2,100, $860, and $1,640, divide evenly by 3. =WRAPCOLS(B2:B7,3) spills $1,250, $980, $1,475 down the first column and $2,100, $860, $1,640 down the second. The first column sums to $3,705. The second sums to $4,600. All six sum to $8,305. The first row of the spill is $1,250 and $2,100, which is $3,350. wrap_count 6 on the same list returns those six amounts as one column. The height is as large as the list, so those six amounts are the whole column.
Five payments dated 3/2/2026 through 3/6/2026 are $420, $315, $180, $95, and $260. =WRAPCOLS(B2:B6,3,0) spills $420, $315, $180 down the first column and $95, $260, 0 down the second. The first column sums to $915. The two payments in the second column sum to $355, and the zero pad keeps that column at $355. All five sum to $1,270. The same five amounts with the pad left out end in #N/A.
Seven Monday totals, the weeks of 3/2/2026, 3/9/2026, 3/16/2026, 3/23/2026, 3/30/2026, 4/6/2026, and 4/13/2026, are $4,200, $3,150, $5,100, $2,800, $6,400, $3,900, and $4,750 in B2:H2. =WRAPCOLS(B2:H2,3) spills $4,200, $3,150, $5,100 down the first column, $2,800, $6,400, $3,900 down the second, and $4,750 with two #N/A cells down the third. The first column sums to $12,450. The second sums to $13,100. The seven weeks sum to $30,300. Microsoft’s sample wraps the letters A through G by 3, and the third column is G with two #N/A cells. Passing “x” as the pad fills those two cells with x. The formula printed on Microsoft’s first sample is =WRAPCOLS(A2:F2,3), the letters A through F, and that one fills two columns with no pad.
TOCOL and TOROW unwind a block into one column or one row. HSTACK places finished arrays side by side. EXPAND pads a block out to a row count and a column count you choose. The unpivot LAMBDA turns a grid back into one row per value. WRAPROWS fills across the rows. A wrap_count below 1 is #NUM!. A range such as A2:B9 has two columns, so it is #VALUE!. A filled cell in the spill is #SPILL!. Excel 2021 and Excel 2019 return #NAME?. Google Sheets has WRAPCOLS, and its default pad is #N/A too.