(Office Insider Beta only)
Windows: 2203 (Build 15104)
Mac: 16.60 (220304)

Wraps the provided row or column of values by columns after a specified number of elements.

Syntax

=WRAPCOLS(vector, wrap_count, [pad_with])

The WRAPCOLS function syntax has the following arguments:

  • vector       The vector or reference to wrap.

  • wrap_count       The maximum number of values for each column.

  • 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 column. Each column has wrap_count elements. The column 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 as the result of the function.

Errors

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

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

  • Excel returns a #N/A error when the return array has missing elements.

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

=WRAPCOLS(A2:F2,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

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

See Also

CHOOSECOLS function

CHOOSEROWS function

WRAPROWS function

Need more help?

Expand your skills
Explore Training
Get new features first
Join Microsoft Office Insiders

Was this information helpful?

What affected your experience?

Thank you for your feedback!

×