Lookup & reference function

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])
ArgumentWhat it means
vectorRequiredA single row or column of values.
wrap_countRequiredHow many values to put in each row before starting the next one.
pad_withOptionalValue 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

C2fx=WRAPROWS(A2:A8, 3, "")
ABCDE
1Attendee
2AnaAnaBenChloe
3BenDevElifFemi
4ChloeGita
5Dev
6Elif
7Femi
8Gita

Seven names fill rows of three: two full rows and a third row with one name and two empty cells.

2Without padding

C2fx=WRAPROWS(A2:A8, 3)
ABCDE
1Attendee
2AnaAnaBenChloe
3BenDevElifFemi
4ChloeGita#N/A#N/A
5Dev
6Elif
7Femi
8Gita

The two leftover cells in the last row show #N/A because no pad value was given.

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 14 KB

Common errors and how to fix them

ErrorWhy it happensFix
#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.

LanguageFunction name
CzechZABALŘÁDKY
DanishFOLDRÆKKER
DutchOMLOOP.RIJEN
FinnishRIVITÄRIV
FrenchORGA.LIGNES
GermanZEILENUMBRUCH
HungarianSORTÖRDELÉS
ItalianA.CAPO.RIGA
PolishZAWIŃ.WIERSZE
RussianСВЕРНСТРОК
SpanishAJUSTARFILAS
SwedishBRYTRAD
TurkishSATIRSAR