WRAPROWS function

WRAPROWS wraps a 1D array into multiple rows, specifying how many columns each row should contain, with optional padding for incomplete rows.

=WRAPROWS(vector, wrap_count, [pad_with])

Generate a WRAPROWS formula

Describe what you need. The generator will reach for WRAPROWS where WRAPROWS is the right tool, and tell you when it is not.

How to get a better answer
  • Name your columns by letter and by header: "column F (Net Value)" beats "the amount column".
  • State every condition, including the negatives — "not cancelled" changes the formula's shape.
  • Say where the data starts if it is not row 1, and whether it will grow.
  • Check the settings above match your spreadsheet: the wrong argument separator is a syntax error on your machine.

Arguments

How WRAPROWS reads its arguments
vectorrequiredwrap_countrequiredpad_withoptionalWRAPROWS
ArgumentRequiredDescription
vectorRequiredA required 1D array or range to wrap. WRAPROWS treats horizontal and vertical ranges identically, converting to column-wise values before wrapping across rows.
wrap_countRequiredA required positive integer specifying the number of elements per row. If 0, negative, or non-numeric, returns #VALUE!.
pad_withOptionalAn optional value to fill empty cells when the vector length doesn't divide evenly by wrap_count. If omitted, empty cells remain blank.

Returns

A 2D array with wrap_count columns and ceiling(length(vector)/wrap_count) rows.

Availability

Excel: 365 · Google Sheets: Not available

Worked examples

1. Organize SKU codes into rows for purchase order printing

SKU
A100
A101
A102
B200
B201
=WRAPROWS(A2:A6, 3)

Result: [["A100","A101","A102"],["B200","B201",""]]

Five SKU codes are wrapped into rows with 3 columns each. The second row contains only 2 values, leaving the third column empty since no pad_with is provided. This layout is ideal for organizing items for batch purchase orders.

2. Wrap warehouse locations with a separator for inventory audits

Warehouse
WH1
WH2
WH3
=WRAPROWS(UNIQUE(B2:B6), 2, "—")

Result: [["WH1","WH2"],["WH3","—"]]

Three unique warehouse codes are wrapped into 2 columns per row and padded with a dash character. The pad_with parameter ensures the second row has a visual separator in the empty cell, creating a consistent format for distribution center audits or facility rosters.

3. Wrap on-hand quantities for a compact inventory report

On Hand
45
15
78
22
5
=WRAPROWS(C2:C6, 2)

Result: [[45,15],[78,22],[5,""]]

Five inventory counts are arranged into rows of 2 columns each. The final row shows one value and one blank cell, making stock levels dense and scannable for management dashboards without artificial padding that could misrepresent data.

Common errors

Which WRAPROWS error are you seeing?
WRAPROWS returned an error#VALUE!
Supply a positive integer ≥ 1: =WRAPROWS(A1:A10, 3) instead of =WRAPROWS(A1:A10, 0) or =WRAPROWS(A1:A10, -2).
#SPILL!
Move the formula to an empty location with sufficient space, or delete blocking data. For example, place it in row 20 if rows 15–18 are occupied.
#N/A
Verify the range exists and is not self-referential. Use a valid range like =WRAPROWS(A2:A6, 3) instead of =WRAPROWS(A1:A1, 3) if A1 contains the formula.
ErrorWhy it happensHow to fix it
#VALUE!wrap_count is zero, negative, or non-numeric. WRAPROWS requires a positive integer to define the number of columns.Supply a positive integer ≥ 1: =WRAPROWS(A1:A10, 3) instead of =WRAPROWS(A1:A10, 0) or =WRAPROWS(A1:A10, -2).
#SPILL!The result array's output region overlaps with existing data or object boundaries. WRAPROWS needs a contiguous empty rectangle to return all wrapped rows and columns.Move the formula to an empty location with sufficient space, or delete blocking data. For example, place it in row 20 if rows 15–18 are occupied.
#N/AThe vector argument references a deleted range, broken external link, or creates a circular reference to the cell containing the formula.Verify the range exists and is not self-referential. Use a valid range like =WRAPROWS(A2:A6, 3) instead of =WRAPROWS(A1:A1, 3) if A1 contains the formula.

Tips and when to use something else

  • Use WRAPCOLS for the opposite behavior: wrapping data down columns instead of across rows.
  • Combine with UNIQUE to eliminate duplicates before wrapping, e.g., =WRAPROWS(UNIQUE(B2:B6), 2), or with FILTER to wrap only rows meeting a condition.
  • If your source is a 2D range, flatten it first with TOCOL or TOROW before wrapping to ensure consistent behavior.
  • For simple transposition or expanding fixed data, EXPAND or TRANSPOSE are faster; reserve WRAPROWS for dynamic data that needs precise column-count control.

Frequently asked questions

Can WRAPROWS include headers in the wrapped output?
Headers are treated as data and wrapped with other values. To preserve headers, reference only the data range (A2:A6 instead of A1:A6) and add headers separately above the result using a static row or additional formula.
How do I fill empty cells with a specific value instead of leaving them blank?
Use the pad_with parameter with your chosen value: =WRAPROWS(A2:A6, 3, 0) fills blanks with zero, or =WRAPROWS(A2:A6, 3, "N/A") fills with text. Any value—text, numbers, or formulas—works.
Does WRAPROWS work on horizontal ranges or only vertical columns?
Both work identically. A vertical range (A1:A10) and a horizontal range (A1:J1) produce the same wrapped output with wrap_count columns. The input orientation does not affect the result.
Why use WRAPROWS instead of manually arranging data into a table layout?
WRAPROWS is dynamic—if source data changes, the wrapped output updates automatically. This is essential for dashboards, inventory reports, and layouts that must scale to variable input sizes without manual rework.

Need a different formula?

The full generator is not scoped to one function — describe any spreadsheet problem and it will pick.

Open the formula generator

Reviewed 2026-09-17