Wraps the provided row or column of values by rows after a specified number of elements to form a new array.

Syntax

=WRAPROWS(vector, wrap_count, [pad_with])

The WRAPROWS function syntax has the following arguments:

  • vector       The vector or reference to wrap.

  • wrap_count       The maximum number of values for each row.

  • pad_with       The value with which to pad. The default is #N/A.

Remarks

The elements of the vector are placed into a 2-dimensional array by row. Each row has wrap_count elements. The row is padded with pad_with if there are insufficient elements to fill it. If wrap_count is greater or equal to the number of elements in vector, then the vector is simply returned in a single row.

Errors

  • Excel returns a #VALUE when vector is not a one-dimensional array.

  • Excel returns a #NUM! when wrap_count is less than 1.

  • Excel returns a #N/A error for each cell in the return array that has no results.

Examples

Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. If you need to, you can adjust the column widths to see all the data.

Wraps the row in range A2:G2 to an array in range A4:C6 of 3 columns. The last two missing elements return #N/A.

Data

A

B

C

D

E

F

G

Formulas

=WRAPROWS(A2:G2,3)

Wraps the row in range A2:G2 to an array in range A4:C6 of 3 columns. The last two missing elements return the pad character "x".

Data

A

B

C

D

E

F

G

Formulas

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

See Also

CHOOSECOLS function

CHOOSEROWS function

WRAPCOLS function

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.