Function · Shape arrays
Excel WRAPROWS function
The Excel WRAPROWS function spills one list into rows. Six amounts in rows of 3 are $1,250, $980, $1,475, then $2,100, $860, $1,640.
Syntax =WRAPROWS(vector, wrap_count, [pad_with])
=WRAPROWS(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 row holds. A wrap_count below 1 is #NUM!. A wrap_count at least as large as the list returns the list as one row. |
| pad_with | Optional | The value used to fill a short last row. Leave it out and the pad is #N/A. |
Examples
Eight territories, three to a row
=WRAPROWS(A2:A9,3)Result Austin, Dallas, Houston; San Antonio, Fort Worth, El Paso; Plano, Arlington, #N/A
Six invoice amounts that fill two rows exactly
=WRAPROWS(B2:B7,3)Result $1,250, $980, $1,475, then $2,100, $860, $1,640
Five March amounts, padded with 0
=WRAPROWS(B2:B6,3,0)Result $420, $315, $180, then $95, $260, and 0
Seven Monday totals, wrapped from a row
=WRAPROWS(B2:H2,3)Result $4,200, $3,150, $5,100; $2,800, $6,400, $3,900; $4,750, #N/A, #N/A
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Rep | City | ||||
| 2 | Austin | Austin | Dallas | Houston | ||
| 3 | Dallas | San Antonio | Fort Worth | El Paso | ||
| 4 | Houston | Plano | Arlington | #N/A | ||
| 5 | San Antonio | |||||
| 6 | Fort Worth | |||||
| 7 | El Paso | |||||
| 8 | Plano | |||||
| 9 | Arlington |
WRAPROWS spills a single row or a single column into a grid, filling across each row. wrap_count is the number of values in each row. A short last row 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. =WRAPROWS(A2:A9,3) spills Austin, Dallas, Houston on the first row, San Antonio, Fort Worth, El Paso on the second, and Plano, Arlington, #N/A on the third. CHOOSECOLS of that spill, column 1, is Austin, San Antonio, and Plano. IFNA of the spill, with an empty string, puts a blank in the last cell.
Six invoice amounts, $1,250, $980, $1,475, $2,100, $860, and $1,640, divide evenly by 3. =WRAPROWS(B2:B7,3) spills $1,250, $980, $1,475 and then $2,100, $860, $1,640. The first row sums to $3,705. The second sums to $4,600. All six sum to $8,305. wrap_count 6 on the same list returns those six amounts as one row. The width is as large as the list, so those six amounts are the whole row.
Five payments dated 3/2/2026 through 3/6/2026 are $420, $315, $180, $95, and $260. =WRAPROWS(B2:B6,3,0) spills $420, $315, $180 and then $95, $260, 0. The first row sums to $915. The two payments on the second row sum to $355, and the zero pad keeps that row 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. =WRAPROWS(B2:H2,3) spills $4,200, $3,150, $5,100, then $2,800, $6,400, $3,900, then $4,750 and two #N/A cells. The first row 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 last row is G with two #N/A cells. Passing “x” as the pad fills those two cells with x.
TOCOL and TOROW unwind a block into one column or one row. VSTACK stacks finished arrays. 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. WRAPCOLS fills down the columns. 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 WRAPROWS, and its default pad is #N/A too.