Skip to content

WRAPCOLS

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

Syntax

=WRAPCOLS(, , )

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
May
Sep
3
Feb
Feb
Jun
Oct
4
Mar
Mar
Jul
Nov
5
Apr
Apr
Aug
Dec
6
May
7
Jun
8
Jul
9
Aug
10
Sep
11
Oct
12
Nov
13
Dec

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

How WRAPCOLS works

WRAPCOLS folds a single list into a grid, filling it column by column. Give it twelve months and a wrap count of 4 and you get four rows and three columns: January to April in the first column, May to August in the second and September to December in the third.

The arguments

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

Reading order

WRAPCOLS fills top to bottom, then moves right, like the columns of a newspaper. That makes it the right choice when each column is a group: quarters of months, shifts of staff, pages of items. WRAPROWS fills left to right, then moves down, like lines of text.

With the same twelve months, WRAPCOLS(A2:A13,4) gives:

  • Jan, Feb, Mar and Apr in the first column
  • May, Jun, Jul and Aug in the second
  • Sep, Oct, Nov and Dec in the third

Each column holds one third of the year, so adding a heading above each column makes a clean quarter-by-quarter table.

Uneven lists

Seven items with a wrap count of 3 fill two columns and put a single item in the third. By default the missing cells show #N/A. Pad them instead: =WRAPCOLS(A2:A8,3,"-") fills the last column with dashes, and 0 fills with zeros. The padding appears only in the last column.

Reshaping data

Data that arrives as one long row can be turned into records. If each record has 4 fields and the data is in a row, =WRAPCOLS(A1:X1,4) returns one record per column, which you can flip with TRANSPOSE if you need records in rows. For the more usual case of a long column, WRAPROWS gives one record per row.

Combining it with other functions

WRAPCOLS accepts the output of other functions. =WRAPCOLS(SORT(A2:A13),4) sorts first and then wraps. =WRAPCOLS(TOROW(A2:C5),2) wraps a flattened block into columns of two.

Notes

A wrap count of 0 or less returns #NUM!. The result spills down and to the right, so #SPILL! means those cells aren't empty. The # operator reads the whole grid, as in =COLUMNS(C2#). See FILTER for more on spills.

WRAPCOLS 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 column of the result. It must be at least 1.
pad_withoptional
What to put in the empty cells of the last column 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 columns of four

C2 =WRAPCOLS(A2:A13,4)

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

Each column holds four months, filled from the top. The first column runs Jan to Apr.

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

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

Example 2

An uneven list, padded with a dash

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

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

Seven codes make two full columns and one with a single code. The two empty cells in the last column get the dash.

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

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

Example 3

Wrap a row of values

A3 =WRAPCOLS(A1:F1,2)

Result: 10, 30, 50; 20, 40, 60

A row works as the input too. Each column of the result holds two consecutive values.

A3
A
B
C
D
E
F
G
H
1
10
20
30
40
50
60
2
3
10
30
50
4
20
40
60
5
6

A3 =WRAPCOLS(A1:F1,2) returns 10, 30, 50; 20, 40, 60

Example 4

The default padding is #N/A

C2 =WRAPCOLS(A2:A8,4)

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

Seven values in columns of four leave one empty cell in the second column. Leave pad_with out and it shows #N/A.

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

C2 =WRAPCOLS(A2:A8,4) returns S-01, S-05; S-02, S-06; S-03, S-07; S-04, #N/A

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 twelve months out so that each column holds three months, filled from the top.

Answer in F2.

F2
A
B
C
D
E
F
G
H
I
J
1
Month
Per column
3
2
Jan
3
Feb
4
Mar
5
Apr
6
May
7
Jun
8
Jul
9
Aug
10
Sep
11
Oct
12
Nov
13
Dec
14
15
16
17
18
19
20

Common mistakes

  • The input must be a single row or column. =WRAPCOLS(A2:C5,2) returns #VALUE!. Flatten a block with TOCOL or TOROW first.
  • The default padding is #N/A. If the grid goes into a total, give pad_with a value such as "" or 0 so the total does not fail.
  • Mixing up the two wrap functions changes the order of the data. WRAPCOLS fills down each column first. If your list should read left to right, use WRAPROWS.
  • A wrap_count of 0 or a negative number returns #NUM!.
  • #SPILL! means the cells the grid needs are not empty. Clear them or move the formula.

Questions people ask

What is the difference between WRAPCOLS and WRAPROWS?

WRAPCOLS fills each column from the top before moving right. WRAPROWS fills each row from the left before moving down. The same list gives the same grid, turned on its side.

How do I split a long list into columns of equal length?

Use `=WRAPCOLS(A2:A31,10)` for columns of ten. The number of columns is worked out for you, and the last column is padded if the list does not divide evenly.

How do I remove the #N/A that WRAPCOLS adds?

Give the third argument: `=WRAPCOLS(A2:A8,3,"")` for blank-looking cells, or `0` for zeros.

Why do I get #VALUE! from WRAPCOLS?

The first argument is a block with more than one row and more than one column. WRAPCOLS accepts only a single row or column. Flatten the block with TOCOL first.

Does WRAPCOLS 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 WRAPCOLS in a real sheet.

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