The `WRAPROWS` function in Excel is used to wrap a single row or column of data into a multi-row/multi-column format. This function is particularly useful when you have a long list of data that you want to display in a table with a specific number of columns. Here’s how you can use it:
Syntax:
WRAPROWS(array, wrap_count, [pad_with])
- `array`: The range or array you want to wrap.
- `wrap_count`: The number of values you want in each row.
- `[pad_with]`: (Optional) The value to fill in if the array doesn’t divide evenly by the wrap count. If not provided, it defaults to an error (#N/A).
Example Usage:
Let’s say you have data in cells `A1:A10` and you want to wrap these values into rows of 3 columns each.
=WRAPROWS(A1:A10, 3)
C1: 1 C2: 2 C3: 3
C4: 4 C5: 5 C6: 6
C7: 7 C8: 8 C9: 9
C10: 10 C11: #N/A C12: #N/A
- Assume `A1:A10` contains the values from 1 to 10.
- In a new cell (say, `C1`), enter the following formula:
- The result will transform your original column into a 3-column, multi-row format:
Since the array has less than 12 numbers (3 rows of 4 values each), the default `#N/A` value is used as filler.
=WRAPROWS(A1:A10, 3, 0)
- To pad the empty cells instead of showing `#N/A`, specify a `pad_with` value like 0 or any other placeholder:
This will replace `#N/A` with 0’s.
Additional Notes:
- The `WRAPROWS` function is available in Excel 365 and Excel 2021 as part of the Dynamic Array functions.
- It simplifies restructuring data without needing manual copying or pasting, especially useful when dealing with data presentations or preparing datasets for specific analyses.
- If you need to create columns instead of rows, you might consider using the `WRAPCOLS` function instead.