Going Stellar

Home/Google Sheets reference

Google Sheets function · Array

WRAPROWS in Google Sheets: syntax and examples

WRAPROWS takes a single row or column and cuts it into rows of wrap_count values each. It turns a long list into a grid.

Syntax

WRAPROWS(range, wrap_count, [pad_with])

Arguments

ArgumentTypeRequiredWhat it does
rangerangeyesA single row or column of values to reshape.
wrap_countnumberyesHow many values go on each new row.
pad_withanynoWhat fills the last row if values run out. Default is #N/A.

Examples

The examples use this table, starting in A1:

10
20
30
40
50
60
=WRAPROWS(A1:A6, 2)

Result:

1020
3040
5060

Six values in a column become three rows of two.

Run in a Google Sheet (English US locale) on .

=WRAPROWS(A1:A6, 3)

Result:

102030
405060

The same list as two rows of three. Values fill each row left to right.

Run in a Google Sheet (English US locale) on .

=WRAPROWS(A1:A5, 2, "-")

Result:

1020
3040
50-

Five values do not fill the last row, so pad_with supplies a dash.

Run in a Google Sheet (English US locale) on .

=WRAPROWS(A1:A5, 2, 0)

Result:

1020
3040
500

Padding with 0 keeps the block numeric.

Run in a Google Sheet (English US locale) on .

=WRAPROWS(TRANSPOSE(A1:A6), 3)

Result:

102030
405060

A row works as input too. Here TRANSPOSE turns the column into a row first.

Run in a Google Sheet (English US locale) on .

Common errors

  • If the values do not fill the last row, the free spots show #N/A. Add pad_with, such as "-" or 0, to fill them.
  • A wrap_count of 0 returns #NUM!.
  • A wrap_count larger than the list returns one row with that many columns, padded with #N/A.

Compared with Excel

Same syntax in Excel.

Sources

  1. WRAPROWS (Docs Editors Help)

Markdown version · All functions