WRAPROWS function
The WRAPROWS function in Excel is used to wrap values from a single row or column into multiple rows, effectively converting a list into a rectangular array by wrapping the data vertically. It arranges the data into a specified number of rows, wrapping the values horizontally.
Syntax
=WRAPROWS(vector, wrap_count, [pad_with])
Parameters
vector: The array or range of values you want to wrap into rows.wrap_count: The number of values per row.[pad_with](optional): A value to fill in any missing cells if the total number of items invectorisn’t evenly divisible bywrap_count. By default, this is blank.
How It Works
- The function takes a list of values (from a single row or column) and wraps them into multiple rows based on the
wrap_countspecified. - If the total number of values is not evenly divisible by
wrap_count, the optionalpad_withargument will fill in the remaining cells.
Examples
Example 1: Wrapping a List into 3 Rows
Suppose you have the following list of values in range A1:A6:
1, 2, 3, 4, 5, 6
To wrap these values into 3 rows, use:
=WRAPROWS(A1:A6, 3)
The output will look like this:
1 2 3
4 5 6
Each row contains 3 values.
Example 2: Wrapping with Padding
If you have fewer values than the specified number of columns and want to pad the remaining cells with a specific value, such as “N/A”:
Let’s say the list has 4 values:
1, 2, 3, 4
To wrap these into 3 rows and fill the remaining cells with “N/A”, use:
=WRAPROWS(A1:A4, 3, "N/A")
The result will be:
1 2 3
4 N/A N/A
Since there aren’t enough values to fill the last row, “N/A” is used to pad the remaining cells.
Key Points to Remember
- WRAPROWS helps when you want to reorganize a list into rows instead of columns.
- The
wrap_countspecifies the number of values per row, dictating how the data is distributed. - The optional
pad_withargument is useful when you want to fill any missing cells if the data isn’t evenly divisible bywrap_count.
Use Case Scenarios
- Rearranging Data: You can convert long lists into more manageable, table-like structures with multiple rows for better visualization or analysis.
- Presentation: When you need to present data in a format that requires specific numbers of rows or cells per row.
The WRAPROWS function allows for easy reorganization of data into a structured format, improving readability and making it easier to analyze data sets.