WRAPROWS function
Wraps a single row or column of values into a grid, filling across each row and starting a new row after a set number of values.
Available in Microsoft 365, Excel 2024, Excel for the web, Excel for Mac 2024+
Excel 2024 and laterWorks in Google Sheets
Syntax
WRAPROWS(vector, wrap_count, [pad_with])| Argument | What it means | |
|---|---|---|
vector | Required | A single row or column of values. |
wrap_count | Required | How many values to put in each row before starting the next one. |
pad_with | Optional | Value for any leftover cells in the last row. Without it they show #N/A. |
Returns: A grid with wrap_count columns, filled row by row, which spills.
How WRAPROWS works
WRAPROWS turns a long list into rows of equal length. Seven attendees split into tables of three, products laid out four to a row for a printable price sheet, or a list of IDs arranged into a grid for labels - the list is read in order and a new row begins every wrap_count items.
If the number of items does not divide evenly, the last row is filled with #N/A unless you supply pad_with (often ""). The input must be a single row or column; flatten a grid first with TOCOL. To fill down columns instead of across rows, use WRAPCOLS.
Examples
1Seating plan, three per table
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Attendee | ||||
| 2 | Ana | Ana | Ben | Chloe | |
| 3 | Ben | Dev | Elif | Femi | |
| 4 | Chloe | Gita | |||
| 5 | Dev | ||||
| 6 | Elif | ||||
| 7 | Femi | ||||
| 8 | Gita |
Seven names fill rows of three: two full rows and a third row with one name and two empty cells.
2Without padding
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Attendee | ||||
| 2 | Ana | Ana | Ben | Chloe | |
| 3 | Ben | Dev | Elif | Femi | |
| 4 | Chloe | Gita | #N/A | #N/A | |
| 5 | Dev | ||||
| 6 | Elif | ||||
| 7 | Femi | ||||
| 8 | Gita |
The two leftover cells in the last row show #N/A because no pad value was given.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#VALUE! | vector is not a single row or column. | Flatten it first with TOCOL or TOROW. |
#NUM! | wrap_count is less than 1. | Use 1 or more. |
Tips
=WRAPROWS(SORT(A2:A8), 3, "")assigns people to tables alphabetically.- Combine with SORTBY and RANDARRAY to shuffle people into random groups.
Google Sheets
WRAPROWS also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.
WRAPROWS in other languages
In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.
| Language | Function name |
|---|---|
| Czech | ZABALŘÁDKY |
| Danish | FOLDRÆKKER |
| Dutch | OMLOOP.RIJEN |
| Finnish | RIVITÄRIV |
| French | ORGA.LIGNES |
| German | ZEILENUMBRUCH |
| Hungarian | SORTÖRDELÉS |
| Italian | A.CAPO.RIGA |
| Polish | ZAWIŃ.WIERSZE |
| Russian | СВЕРНСТРОК |
| Spanish | AJUSTARFILAS |
| Swedish | BRYTRAD |
| Turkish | SATIRSAR |