WRAPROWS Function¶
The WRAPROWS function in Excel is used to wrap a row or column of values into a two-dimensional array by rows. It takes a one-dimensional array and reshapes it into multiple rows of a specified size.
Key Features of WRAPROWS:¶
- Wraps a single row or column into a 2D array filled row by row.
- Allows you to specify how many values appear in each row.
- 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 row (determines the number of columns 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 WRAPROWS Works:¶
- The function takes the source vector and reads its values sequentially.
- It fills the first row with the first
wrap_countvalues. - It then moves to the next row 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 row are filled with thepad_withvalue. - The result is a 2D array with
wrap_countcolumns and as many rows as needed.
Examples:¶
1. Wrap a Row into 3-Column Rows:¶
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:¶
WRAPROWSis 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. WRAPROWSfills by row (left to right, then top to bottom), whileWRAPCOLSfills by column.
Applications:¶
- Data Reshaping: Convert a long list into a multi-row layout for easier viewing.
- Report Formatting: Arrange data into fixed-width rows for dashboard displays.
- Calendar Creation: Wrap sequential dates or numbers into week-based rows.
- Matrix Operations: Prepare vectors for matrix calculations requiring specific dimensions.
- Data Entry Forms: Transform linear input into structured grid layouts.
Related Functions:¶
- WRAPCOLS: Wraps a row or column into a 2D array by columns (fills top to bottom, then left to right).
- 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
WRAPROWSwithSEQUENCEto quickly create grid layouts from sequential data. For example,=WRAPROWS(SEQUENCE(1,100),10)creates a 10-row by 10-column grid of numbers 1 to 100 filled by rows.