WRAPCOLS Function¶
The WRAPCOLS function in Excel is used to wrap a row or column of values into a two-dimensional array by columns. It takes a one-dimensional array and reshapes it into multiple columns of a specified size.
Key Features of WRAPCOLS:¶
- Wraps a single row or column into a 2D array filled column by column.
- Allows you to specify how many values appear in each column.
- Fills any remaining cells with a customizable pad value (or
#N/Aby default). - Works seamlessly with other dynamic array functions.
- Useful for reshaping data for reports, dashboards, and matrix operations.
Syntax:¶
- vector: A row or column of values to wrap.
- wrap_count: The maximum number of values per column (determines the number of rows in the result).
- pad_with (optional): The value to fill in empty cells if the vector doesn't divide evenly. If omitted,
#N/Ais used.
How WRAPCOLS Works:¶
- The function takes the source vector and reads its values sequentially.
- It fills the first column with the first
wrap_countvalues. - It then moves to the next column and continues filling until all values are placed.
- If the total number of values is not evenly divisible by
wrap_count, the remaining cells in the last column are filled with thepad_withvalue. - The result is a 2D array with
wrap_countrows and as many columns as needed.
Examples:¶
1. Wrap a Row into 3-Row Columns:¶
Result:
2. Wrap with Padding (Uneven Division):¶
Result:
3. Wrap with Custom Pad Value:¶
Result:
4. Wrap a Column Range:¶
Result:
5. Wrap with Text Padding:¶
Result:
6. Combine with SEQUENCE:¶
Result:
7. Wrap a Filtered List:¶
Result:
8. Create a Calendar-Style Layout:¶
Result:
Notes:¶
WRAPCOLSis available in Excel 365 and Excel 2021 or later versions.- The
vectormust be a single row or single column; multi-row, multi-column arrays return a#VALUE!error. - If
wrap_countis less than 1 or not a valid number, Excel returns a#VALUE!error. - The
pad_withvalue can be a number, text, logical value, or error value. WRAPCOLSfills by column (top to bottom, then left to right), whileWRAPROWSfills by row.
Applications:¶
- Data Reshaping: Convert a long list into a multi-column layout for easier viewing.
- Report Formatting: Arrange data into fixed-height columns for dashboard displays.
- Calendar Creation: Wrap sequential dates or numbers into week-based columns.
- Matrix Operations: Prepare vectors for matrix calculations requiring specific dimensions.
- Data Entry Forms: Transform linear input into structured grid layouts.
Related Functions:¶
- WRAPROWS: Wraps a row or column into a 2D array by rows (fills left to right, then top to bottom).
- TOCOL: Converts an array to a single column.
- TOROW: Converts an array to a single row.
- TRANSPOSE: Rotates rows to columns and columns to rows.
- TAKE: Extracts a specified number of rows or columns from an array.
- DROP: Excludes a specified number of rows or columns from an array.
- CHOOSECOLS: Returns specified columns from an array.
- CHOOSEROWS: Returns specified rows from an array.
Tip: Use
WRAPCOLSwithSEQUENCEto quickly create grid layouts from sequential data. For example,=WRAPCOLS(SEQUENCE(1,100),10)creates a 10-row by 10-column grid of numbers 1 to 100 filled by columns.