How to Use WRAPROWS and WRAPCOLS Dynamic Vector Functions in Google Sheets

Data imported from external CSV files, web-scraped API feeds, or raw bar-code scanner logs often arrives as a single, continuous vertical column or endless horizontal row of unstructured data points. For instance, customer records might stream sequentially as Name, Email, Phone, Company repeated continuously down column A. Manually reshaping thousands of linear records into a structured tabular grid previously required brittle INDEX(MOD(...)) formulas. Google Sheets modernizes dimensional array reshaping with WRAPROWS and WRAPCOLS.

Syntax and Parameters of WRAPROWS

The WRAPROWS function wraps a one-dimensional row or column vector into a two-dimensional matrix by populating values horizontally across rows up to a specified column limit:

=WRAPROWS(vector, wrap_count, [pad_with])
  • vector: The source one-dimensional range of cells to reshape (e.g., A2:A100).
  • wrap_count: The maximum number of values in each row before wrapping to the next line.
  • [pad_with]: Optional value to fill empty cells if the final row does not contain enough elements to complete the wrap count (defaults to #N/A).

Basic WRAPROWS Example: Structuring Imported Contact Lists

Suppose column A contains sequential client data where every 4 rows represent a single client record (Name, Email, Phone, City):

# Reshape the linear vector into a 4-column structured table
=WRAPROWS(A2:A400, 4, "")

Setting pad_with to "" ensures that if the dataset has missing tail elements, empty blank cells appear instead of unsightly #N/A errors.

Syntax and Applications of WRAPCOLS

While WRAPROWS populates values horizontally left-to-right, WRAPCOLS wraps values vertically down columns up to a specified row limit:

=WRAPCOLS(vector, wrap_count, [pad_with])
  • wrap_count: The maximum number of values in each column before moving to the next adjacent column.

Example: Creating a 7-Day Weekly Calendar Grid

# Wrap 28 sequential daily revenue totals into 7-row weekly columns
=WRAPCOLS(B2:B29, 7)

Combining WRAPROWS with FILTER and TOCOL Pipelines

Modern Google Sheets formulas shine when chaining array functions together. You can clean messy multi-column inputs and re-wrap them into standardized cards:

# Flatten a messy unstructured range, remove blank cells, and wrap into neat 3-column inventory cards
=WRAPROWS(TOCOL(RawData!A2:Z100, 1), 3, "N/A")

By transforming linear data streams into clean matrices in a single lightweight formula, WRAPROWS and WRAPCOLS accelerate dashboard creation and data preparation workflows.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.