Skip to content

WRAPROWS

Wraps a single row or column of values into a grid, filling each row before starting the next.

Syntax

=WRAPROWS(, , )

Dynamic arrays

Excel for Microsoft 365, Excel 2024 and later, and Excel for the web. Not available in Excel 2021 or earlier.

Try it

Edit the formula in C2 or change the inputs. The sheet recalculates as you type.

C2
A
B
C
D
E
F
G
H
1
Month
2
Jan
Jan
Feb
Mar
Apr
3
Feb
May
Jun
Jul
Aug
4
Mar
Sep
Oct
Nov
Dec
5
Apr
6
May
7
Jun
8
Jul
9
Aug
10
Sep
11
Oct
12
Nov
13
Dec

C2 =WRAPROWS(A2:A13,4) returns Jan, Feb, Mar, Apr; May, Jun, Jul, Aug; Sep, Oct, Nov, Dec

How WRAPROWS works

WRAPROWS folds a single list into a grid. Give it twelve months in a column and a wrap count of 4 and you get three rows of four. It fills each row from left to right before starting the next, the way you read a page.

The arguments

  • vector is the list to wrap. It must be one column or one row. Pass a block of several rows and columns, and WRAPROWS returns #VALUE!. Use TOCOL first if you need to flatten a block.
  • wrap_count is how many values go in each row. The number of rows is worked out for you: 12 values with a wrap count of 4 gives 3 rows.
  • pad_with fills the gap when the last row isn't full.

Uneven lists and padding

Seven items with a wrap count of 3 make two full rows and one with a single item. By default the missing two cells show #N/A, which stands out and can break a total. Give a pad value to replace it: =WRAPROWS(A2:A8,3,"") leaves the cells blank-looking, and =WRAPROWS(A2:A8,3,0) fills them with zeros. The padding value goes in the last row only.

Where it helps

  • Layouts. Turn a list of seat holders, products or months into a block that fits a page or a dashboard.
  • Calendars and quarters. Twelve months wrap into four columns, or into three rows of four with wrap_count 4.
  • Reshaping imports. Data that arrives as one long column, with a fixed number of fields per record, can be wrapped into one record per row. If each record has 5 fields, =WRAPROWS(A2:A101,5) returns 20 rows of 5 columns.

WRAPROWS or WRAPCOLS

WRAPCOLS does the same but fills down each column first. Use WRAPROWS when the list should read like text, left to right. Use WRAPCOLS when it should read like a newspaper, top to bottom.

Combining it with other functions

WRAPROWS works on the output of other dynamic array functions. =WRAPROWS(SORT(A2:A13),4) sorts first and then lays the sorted list out in rows of four. Because the result is a spilled array, you can feed it to HSTACK, VSTACK or INDEX as well.

Notes

A wrap count of 0 or less returns #NUM!. The result spills down and to the right, and #SPILL! means those cells aren't empty. Read the whole grid in another formula with #, as in =ROWS(C2#). See FILTER for details.

WRAPROWS needs Microsoft 365, Excel 2024 or later, or Excel for the web.

Arguments

vector
A single row or a single column of values. A range with several rows and columns returns #VALUE!.
wrap_count
How many values go in each row of the result. It must be at least 1.
pad_withoptional
What to put in the empty cells of the last row when the values do not divide evenly. The default is #N/A. Give "" for blanks, 0 for zeros or any text you like.

Examples

Each example is a live sheet. Change the inputs or the formula and watch the result.

Example 1

Twelve months in rows of four

C2 =WRAPROWS(A2:A13,4)

Result: Jan, Feb, Mar, Apr; May, Jun, Jul, Aug; Sep, Oct, Nov, Dec

Each row takes four values from the list, left to right, before the next row starts.

C2
A
B
C
D
E
F
G
H
1
Month
2
Jan
Jan
Feb
Mar
Apr
3
Feb
May
Jun
Jul
Aug
4
Mar
Sep
Oct
Nov
Dec
5
Apr
6
May
7
Jun
8
Jul
9
Aug
10
Sep
11
Oct
12
Nov
13
Dec

C2 =WRAPROWS(A2:A13,4) returns Jan, Feb, Mar, Apr; May, Jun, Jul, Aug; Sep, Oct, Nov, Dec

Example 2

An uneven list is padded with #N/A

C2 =WRAPROWS(A2:A8,3)

Result: D-01, D-02, D-03; D-04, D-05, D-06; D-07, #N/A, #N/A

Seven values do not fill three rows of three, so the last two cells get the default padding.

C2
A
B
C
D
E
F
G
H
1
Seat holder
2
D-01
D-01
D-02
D-03
3
D-02
D-04
D-05
D-06
4
D-03
D-07
#N/A
#N/A
5
D-04
6
D-05
7
D-06
8
D-07
9

C2 =WRAPROWS(A2:A8,3) returns D-01, D-02, D-03; D-04, D-05, D-06; D-07, #N/A, #N/A

Example 3

Pad with a dash instead

C2 =WRAPROWS(A2:A8,3,"-")

Result: D-01, D-02, D-03; D-04, D-05, D-06; D-07, -, -

The third argument replaces #N/A. Use "" for empty-looking cells.

C2
A
B
C
D
E
F
G
H
1
Seat holder
2
D-01
D-01
D-02
D-03
3
D-02
D-04
D-05
D-06
4
D-03
D-07
-
-
5
D-04
6
D-05
7
D-06
8
D-07
9

C2 =WRAPROWS(A2:A8,3,"-") returns D-01, D-02, D-03; D-04, D-05, D-06; D-07, -, -

Example 4

Wrap a row of values

A3 =WRAPROWS(A1:F1,2)

Result: Mon, Tue; Wed, Thu; Fri, Sat

A single row works as well as a column.

A3
A
B
C
D
E
F
G
H
1
Mon
Tue
Wed
Thu
Fri
Sat
2
3
Mon
Tue
4
Wed
Thu
5
Fri
Sat
6

A3 =WRAPROWS(A1:F1,2) returns Mon, Tue; Wed, Thu; Fri, Sat

Your turn.

Solve it in the sheet. Every answer is checked, with hints if you need them.

Task 1 of 2

In F2, lay the ten items in A2:A11 out in rows, with the number of items per row taken from D1.

Answer in F2.

F2
A
B
C
D
E
F
G
H
I
J
1
Item
Per row
3
2
Gloves
3
Tape
4
Wrap
5
Labels
6
Bags
7
Boxes
8
Pens
9
Pads
10
Clips
11
Ink
12
13
14
15
16
17
18
19
20

Common mistakes

  • The input must be a single row or column. =WRAPROWS(A2:C5,2) returns #VALUE!. Flatten a block first with TOCOL.
  • Uneven lists show #N/A in the last row. Give a pad_with value such as "" or 0 before the grid goes into a total, or the total shows #N/A.
  • A wrap_count of 0 or a negative number returns #NUM!. If it comes from a cell, check that the cell holds a positive number.
  • Rows fill left to right. If you expected the list to run down each column first, use WRAPCOLS.
  • #SPILL! means the cells the grid needs are not empty. Clear them or move the formula.

Questions people ask

How do I turn a long column into a grid with several columns?

Use `=WRAPROWS(A2:A101,5)`. Each row of the grid takes five values, filling left to right. Use WRAPCOLS if the list should fill down each column first.

How do I get rid of the #N/A at the end of a WRAPROWS grid?

Add a third argument to pad the empty cells: `=WRAPROWS(A2:A8,3,"")` for blank-looking cells, or `0` for zeros.

Why does WRAPROWS return #VALUE!?

Its first argument has more than one row and more than one column. It accepts only a single row or a single column. Use TOCOL or TOROW to flatten the block first.

What is the difference between WRAPROWS and WRAPCOLS?

WRAPROWS fills each row from left to right before moving down. WRAPCOLS fills each column from top to bottom before moving right.

Does WRAPROWS work in Excel 2021?

No. It is available in Microsoft 365, Excel 2024 and later, and Excel for the web. In earlier versions the formula returns `#NAME?`.

Learn WRAPROWS in a real sheet.

Tracks take you from the basics to modelling, one graded exercise at a time.