=WRAPCOLS(vector, wrap_count, [pad_with])
- vector - The single row or column to wrap.
- wrap_count - The number of values in each column.
- pad_with - [optional] Value to use for unfilled places in the last column.
Using the WRAPCOLS function
The WRAPCOLS function converts a single row or column into a table by wrapping values into columns. Columns are filled from top to bottom, and the length of each column is provided as the wrap_count argument. When the count is reached, WRAPCOLS starts a new column. The result spills onto the worksheet as a 2D array.
The name WRAPCOLS can be confusing, because it suggests that the function wraps input provided as one or more columns. The actual meaning is "wrap into columns": WRAPCOLS wraps a vector (a single row or column) into columns. The WRAPROWS function works the same way, but it wraps the vector into rows.

A common reason to use WRAPCOLS is to lay out a long list in several columns, like a list of names for a printout. Because WRAPCOLS fills each column before it starts the next one, the list keeps its order reading down each column, which is how people expect to read a list. WRAPCOLS is also a good fit for values in a row, like 12 months of sales. When the values are wrapped into columns, each column is a group, and functions like BYCOL can work on the groups one at a time. See below for examples.
WRAPCOLS wraps a list of values into columns. It has nothing to do with wrapping text inside a cell. For that, see How to wrap text in cells in Excel.
Key features
- Turns a single column or row into a table, filling each column from top to bottom, then starting the next column.
- wrap_count is the length of each column (the number of rows), not the number of columns.
- When the values don't divide evenly, the last column is padded with #N/A unless you supply pad_with.
- Needs a single row or column. A 2D range returns #VALUE!, so flatten with TOCOL first if needed.
- Returns an array, so functions like BYCOL, TAKE, and CHOOSEROWS can work with the result directly.
- The WRAPROWS function does the same job by row.
Table of contents
- Basic examples
- Wrap count example
- Padding example
- WRAPCOLS vs WRAPROWS
- Split a list into columns
- Rebuild a table pasted by column
- Spread a list over n columns
- Monthly to quarterly totals
- Get every nth value in a row
- Notes
Basic examples
WRAPCOLS needs a list and a column length, provided as wrap_count:
=WRAPCOLS(range,3) // columns of 3 values
=WRAPCOLS(range,4) // columns of 4 values
When the number of values doesn't divide evenly by wrap_count, WRAPCOLS fills the empty places in the last column with #N/A. To override this value, provide your own value for pad_with:
=WRAPCOLS(range,3,"") // pad with nothing
=WRAPCOLS(range,3,"x") // pad with "x"
Wrap count example
The wrap_count argument sets the number of values in each column. When the count is reached, WRAPCOLS starts a new column. In the worksheet below, column B contains the 12 letters A to L. The formula in D5 uses a wrap_count of 4:
=WRAPCOLS(B5:B16,4)
The formula in D11 uses a wrap_count of 3:
=WRAPCOLS(B5:B16,3)

With a wrap_count of 4, WRAPCOLS returns 3 columns of 4 letters. With a wrap_count of 3, it returns 4 columns of 3 letters. In both cases, WRAPCOLS fills each column from top to bottom before it starts the next column, and it works out the number of columns on its own.
Padding example
When the number of values doesn't divide evenly by wrap_count, the last column comes up short, and WRAPCOLS fills the empty places with #N/A errors. In the worksheet below, column B contains the 10 letters A to J. The formula in D5 wraps the letters into columns of 4 with no value for pad_with:
=WRAPCOLS(B5:B14,4)
Because 10 doesn't divide evenly by 4, the last column has only 2 letters, and the last 2 places return #N/A. To override this behavior, provide a value for pad_with. The formula in D11 uses "x":
=WRAPCOLS(B5:B14,4,"x")

Notice the #N/A errors have been replaced by "x" in the last column.
WRAPCOLS vs WRAPROWS
The WRAPROWS function works like WRAPCOLS, but it wraps values into rows instead of columns. In the worksheet below, column B contains the numbers 1 to 12. The formula in D5 wraps the numbers with WRAPCOLS:
=WRAPCOLS(B5:B16,4)
The formula in D11 wraps the same numbers with WRAPROWS:
=WRAPROWS(B5:B16,4)

WRAPCOLS fills each column from top to bottom before it starts the next column, so the result is 3 columns of 4 numbers. WRAPROWS fills each row from left to right before it starts the next row, so the result is 3 rows of 4 numbers. In other words, wrap_count is the length of each column in WRAPCOLS and the length of each row in WRAPROWS. Which function to use depends on the order of the values in your list, as the examples below show.
Split a list into columns
One way to use WRAPCOLS is to split a list of values into columns that fit on a printed page or a single screen. In the worksheet below, column B contains 12 names in alphabetical order, and the goal is to lay out the names in 3 columns. The formula in D5 is:
=WRAPCOLS(B5:B16,4)

WRAPCOLS fills each column from top to bottom before it starts the next column, so the names stay in alphabetical order reading down each column. Notice that wrap_count is 4, not 3, because wrap_count sets the length of each column: 12 names / 4 = 3 columns. WRAPROWS could also be used to arrange the names in a table, but =WRAPROWS(B5:B16,3) puts Aisha, Ben, and Carlos in the first row, so the list reads across instead of down. To choose the number of columns instead of the column length, see Spread a list over n columns below.
Rebuild a table pasted by column
When you copy a table from a PDF or a web page, the data sometimes lands in a single column, one column of the table at a time: first the Name header and the names, then the Department header and the departments, and so on. In the worksheet below, column B contains a table of 3 contacts pasted this way. The goal is to rebuild the original table. The formula in D4 is:
=WRAPCOLS(B5:B16,4)

Each block in column B has 4 values (a header plus 3 contacts), so a wrap_count of 4 puts each block in its own column, and the headers land in the first row. The result is the original table, 4 rows by 3 columns. This approach only works when every block has the same number of values, because wrap_count is a single number.
Note that the order of values in the list determines whether to use WRAPCOLS or WRAPROWS in a case like this. Here, the values are already ordered by column. When the list is organized by record instead (the name, department, and extension for the first person, then the next person), use WRAPROWS, as shown in Convert a list into a table on the WRAPROWS page.
Spread a list over n columns
In Split a list into columns, wrap_count is 4 because 12 names divide evenly into 3 columns of 4. However, sometimes you will know how many columns you want, not how long each column should be. Because wrap_count sets the column length, you need to work out the length from the number of values. In the worksheet below, column B contains 26 names, and the goal is to spread the names over 4 columns. The formula in D5 is:
=WRAPCOLS(B5:B30,ROUNDUP(ROWS(B5:B30)/4,0),"")

Working from the inside out, the ROWS function counts the names (26), and the count is divided by 4, the number of columns we want. The result, 6.5, is rounded up to 7 by the ROUNDUP function, so WRAPCOLS returns columns of 7 names:
=WRAPCOLS(B5:B30,7,"")
The last column has only 5 names, so pad_with is an empty string, which leaves the 2 extra places empty, as in the Padding example above. To use a different number of columns, change the 4 in the formula.
Note: this formula can return fewer columns than you ask for. For example, 9 names spread over 4 columns gives a column length of ROUNDUP(9/4,0) = 3, and WRAPCOLS returns 3 columns of 3 names. With 9 names, no column length gives exactly 4 columns: a length of 3 gives 3 columns, and a length of 2 gives 5 columns.
To shuffle a list of names into random teams before wrapping, see Make random teams on the WRAPROWS page.
Monthly to quarterly totals
Once each group of values is in its own column, other functions can work with the groups one at a time. This works especially well when the values are in a row. In the worksheet below, row 5 contains sales for 12 months, and the goal is to calculate a total for each quarter. The formula in C8 is:
=BYCOL(WRAPCOLS(C5:N5,3),SUM)

Working from the inside out, WRAPCOLS wraps the 12 amounts into 4 columns of 3, one column per quarter:
{120,140,170,130;135,150,160,125;110,165,145,180}
Then the BYCOL function runs the SUM function on each column and returns one total per quarter:
=BYCOL({120,140,170,130;135,150,160,125;110,165,145,180},SUM) // returns {365,455,475,435}
Because BYCOL returns one result per column, the 4 totals spill into a row, under the data. The SUM function is given to BYCOL by name only. This short form is called an eta lambda. To get the average or the largest value for each quarter instead, swap in AVERAGE or MAX the same way.
If the number of values doesn't divide evenly by 3, the last column is padded with #N/A, and SUM returns #N/A for that group. To fix the problem, provide a value for pad_with. For a sum, use zero or an empty string. For an average, use an empty string, because AVERAGE ignores empty strings in an array but counts zeros. Sum every n rows on the WRAPROWS page explains this in more detail with BYROW and values in a column. For an older formula that totals every 3 cells in a row, see Sum every 3 cells.
Get every nth value in a row
WRAPCOLS also makes it easy to pick values from a row in a repeating pattern, like every 3rd value. In the worksheet below, row 5 contains the letters A to L, and the goal is to get every 3rd value. The formula in C8 is:
=TAKE(WRAPCOLS(C5:N5,3),-1)

The trick is to see that every 3rd value lands in the last row when the values are wrapped into columns of 3:
{"A","D","G","J";"B","E","H","K";"C","F","I","L"}
The TAKE function then returns the last row: -1 for rows means one row from the end. The result is {"C","F","I","L"}, in a row under the data. To get the first value in each group of 3 instead, use 1 for rows. The formula in C10 is:
=TAKE(WRAPCOLS(C5:N5,3),1) // returns {"A","D","G","J"}
If the number of values isn't a multiple of 3, the last result in the every-3rd row is #N/A padding, as in the Padding example. To keep more than one row, use the CHOOSEROWS function. For example, the formula below returns the first and third value in each group of 3 as two rows:
=CHOOSEROWS(WRAPCOLS(C5:N5,3),1,3)
For other ways to solve this problem, see Copy value from every nth column and Sum every nth column.
Notes
- WRAPCOLS returns #VALUE! if vector is not a single row or column. Flatten a 2D range with TOCOL or TOROW first. TOCOL reads the range by row by default, or by column when scan_by_column is TRUE, and that order carries through to the wrapped result.
- wrap_count must be at least 1, or WRAPCOLS returns #NUM!. A decimal wrap_count is truncated, so 2.9 wraps by 2.
- If vector has no more values than wrap_count, WRAPCOLS returns one column with just those values, and there is no padding. For example, 3 values wrapped by 4 return 3 values.
- Empty cells in vector appear as zeros in the result on the worksheet, which is standard behavior for Excel formulas.
- Every group must have the same number of values. WRAPCOLS can't wrap groups of different lengths.
- WRAPCOLS returns #SPILL! if something blocks the spill range.
- WRAPCOLS is available in Excel 2024+ and Excel 365. It is not available in Excel 2021.