Function Reference: WRAPCOLS, WRAPROWS

Syntax
=WRAPCOLS(vector,[wrap_count],[pad_with])
=WRAPROWS(array,[wrap_count],[pad_with])
Purpose / Description
Returns an array in which the values from the initial vector (a single column or single row of values) have been transferred to a two-dimensional array with a given number of columns or rows.  Since the entries may not neatly fill the array block, the value to pad unfilled cells can be specified as an optional argument.
Arguments
Name Type Description
vector reference or array of any A reference or nested expression that returns a valid reference, a constant array of any values or a nested expression that returns an array of any values.  The argument name vector reminds that the input may not be a two-dimensional range or array, but rather either a single column or single row of values.  Either column or row can be used for both functions.
[wrap_count] number A reference to a range, a nested expression or constant number that indicates the maximum number of rows required (WRAPCOLS) or the maximum number of columns required (WRAPROWS).  If the value passed is not a number, the standard coercion rules apply and the value is coerced to a number if possible.  The number must be a value greater than or equal to 1.  If the number passed is not an integer it is truncated to the next lowest integer.
[pad_with] any A value to be used to pad any cells in the output array that are not filled by the values in the input vector.  If omitted, the default value used is #N/A.
Return Values
Type Specific Value Description
array of any   Regardless of whether the original vector is a reference to a range, a calculated array, or a constant array, the result returned is an array containing the values from vector, arranged as an array.
If the number of values in vectoris ≤ wrap_count then a single column (WRAPCOLS) or row (WRAPROWS) array is returned with the number of entries in vector.
error #VALUE! If vector is not a one-dimensional range or array, containing only one column or row of values.
error #NUM! If the size of value of wrap_count is < 1.
error #N/A In unfilled cells if the value of pad_with is not specified.
error   Any errors referenced by arguments are returned due to propagation of error values..
Notes / Comments / Advice / Warnings
Comment: These are useful additions to Excel, allowing for the reformatting of a sequence of row and column data into tables for dashboards and reporting.
Examples: Open / download sample workbook: TOCOL, TOROW, WRAPCOLS, WRAPROWS.xlsx