ID EN
#Dynamic array

WRAPROWS

Excel Functions

Wrap array into rows

Syntax

EXCEL
=WRAPROWS(vector, wrap_count, [pad_with])

Arguments

Parameter Description
vector The array or range to wrap.
wrap_count Max values in each row.
pad_with [optional] Value to use for unfilled places.

Return Value

Array wrapped by row

Details

The WRAPROWS function converts a one-dimensional array into a two-dimensional array by wrapping values into separate rows. The length of each row is provided as the wrap_count argument: when the count is reached, WRAPROWS starts a new row. The WRAPROWS function takes three arguments: vector, wrap_count, and pad_with. Vector and wrap_count are both required. Vector must be a one-dimensional array or range. Wrap_count is a number that represents the length of each row. The final argument, pad_with, is an optional value to use if there are unfilled places in the last row. If no value is supplied, WRAPROWS will return an #N/A error after all values in vector have been used, and there are still unfilled places in the resulting array. You can override this behavior by providing a custom value fo

Examples

Basic usage

WRAPROWS outputs values "by row", working left to right, top to bottom. When wrap_count has been reached, WRAPROWS starts a new row. In the worksheet

EXCEL
=WRAPROWS(C2:J2,4)
Wrap count

Wrap_count represents the maximum number of values in each row. Once the count has been reached, WRAPROWS starts a new row. In the screen below, you c

EXCEL
=WRAPROWS(B3:B14,4)
Wrap count

The formula in D9 uses a wrap_count of 3:

EXCEL
=WRAPROWS(B3:B14,3)
Padding

If no value is supplied for pad_with, WRAPROWS will return an #N/A error after all values in the source array have been accounted for. You will see th

EXCEL
=WRAPROWS(B3:B12,4)
Padding

The input range contains only 10 cells, which is not evenly divisible by 4. As a result, the last 2 cells return #N/A. To override this behavior, prov

EXCEL
=WRAPROWS(B3:B12,4,"x")

See Also

WRAPCOLS TOROW TOCOL