WRAPROWS

Formulas / WRAPROWS
To wrap a row or column by a certain number of rows which creates a new array.
=WRAPROWS(vector, wrap_count, [pad_width])
  • vector - The input vector or reference that is to be wrapped.
  • wrap_count-The maximum number of elements allowed in each row of the resulting array.
  • pad_width - [optional]The value used for padding, if needed. By default, this value is set to #N/A.

Examples

  • =WRAPROWS(A2:G2,3)

    In this example, the row of values in the range A2:G2 is reformatted into an array in the range A4:C6, with each row containing a maximum of 3 columns. The last two empty positions in the array are filled with #N/A.

  • =WRAPROWS(A2:G2,3,"x")

    The row of values in the range A2:G2 is transformed into an array located in the range A4:C6, where each row consists of 3 columns. The final two empty positions in the array are filled with the padding character "x."


Summary

The WRAPROWS function reformats the given row or column of values into a new array by wrapping the elements into rows after reaching a specified element count.

  • If the vector is not a one-dimensional array, WRAPROWS function will display the #VALUE error.
  • If the wrap_count is less than 1, the WRAPROWS function will display the #NUM! error.
  • When there are no results for a cell in the return array, the WRAPROWS function will display the #N/A error.

Frequently Asked Questions

How does the function work when the elements of a vector are placed into a 2-dimensional array by row?
When the elements of a vector are placed into a 2-dimensional array by row, each row of the array contains a specified number of elements, referred to as the wrap_count.
what happens when there are insufficient elements to fill a row?
If a row does not have enough elements to reach the wrap_count, it is padded with a specified value, known as pad_width, to fill the remaining positions.
what happens when the wrap_count is greater or equal to the number of elements in the vector?
If the wrap_count is greater than or equal to the total number of elements in the vector, the function simply returns the original vector as a single row without any padding.
Sourcetable Logo

Work smarter

Al is here to help. Leverage the latest models to
analyze spreadsheets, enrich data, and create reports.

Drop CSV