TOROW function

TOROW converts a multi-dimensional array into a single horizontal row, arranging all elements left-to-right, top-to-bottom by default.

=TOROW(array, [ignore], [scan_by_column])

Generate a TOROW formula

Describe what you need. The generator will reach for TOROW where TOROW 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 TOROW reads its arguments
arrayrequiredignoreoptionalscan_by_columnoptionalTOROW
ArgumentRequiredDescription
arrayRequiredRequired. A range or array to flatten into a row; can be 1D or multi-dimensional.
ignoreOptionalOptional. How to handle empty cells or errors: 0 (default, include all), 1 (skip empty), or 2 (skip errors).
scan_by_columnOptionalOptional. If TRUE, scans each column fully before moving to the next; if FALSE or omitted, scans each row fully before moving down.

Returns

A single-row array (1D horizontal) containing all elements from the input array.

Availability

Excel: 365 · Google Sheets: Not available

Worked examples

1. Flatten a table of employees into a single row

Employee IDNameDepartmentHire DateSalaryStatus
E001Alice JohnsonSales2021-03-1575000Active
E002Bob SmithMarketing2022-01-1065000Active
E003Carol WilliamsIT2020-06-2285000On Leave
E004David BrownFinance2023-02-2872000Active
=TOROW(A2:F5)

Result: {E001; Alice Johnson; Sales; 2021-03-15; 75000; Active; E002; Bob Smith; Marketing; 2022-01-10; 65000; Active; E003; Carol Williams; IT; 2020-06-22; 85000; On Leave; E004; David Brown; Finance; 2023-02-28; 72000; Active}

TOROW scans the 4×6 table row-by-row (left to right, top to bottom) and arranges all 24 values into a single horizontal array. This is useful for exporting nested data as a continuous sequence for reports or data exports.

2. Flatten employee data while removing blank cells

Employee IDNameDepartmentHire DateSalaryStatus
E001Alice JohnsonSales75000Active
E002Bob SmithMarketing2022-01-10Active
E003Carol WilliamsIT2020-06-2285000
E004David BrownFinance2023-02-2872000Active
=TOROW(A2:F5, 1)

Result: {E001; Alice Johnson; Sales; 75000; Active; E002; Bob Smith; Marketing; 2022-01-10; Active; E003; Carol Williams; IT; 2020-06-22; 85000; E004; David Brown; Finance; 2023-02-28; 72000; Active}

With ignore=1, TOROW skips empty cells in the range, reducing the output array size from 24 to 20 elements. This is helpful when your source data has missing values you want to exclude from the flattened result.

3. Organize flattened data by column instead of by row

Employee IDNameDepartmentHire DateSalaryStatus
E001Alice JohnsonSales2021-03-1575000Active
E002Bob SmithMarketing2022-01-1065000Active
E003Carol WilliamsIT2020-06-2285000On Leave
E004David BrownFinance2023-02-2872000Active
=TOROW(A2:F5,,TRUE)

Result: {E001; E002; E003; E004; Alice Johnson; Bob Smith; Carol Williams; David Brown; Sales; Marketing; IT; Finance; 2021-03-15; 2022-01-10; 2020-06-22; 2023-02-28; 75000; 65000; 85000; 72000; Active; Active; On Leave; Active}

By setting scan_by_column=TRUE, TOROW processes each column entirely before moving to the next, grouping all Employee IDs first, then all Names, then all Departments, etc. This reorganizes the data by column rather than row, useful when you need column-wise grouping.

Common errors

Which TOROW error are you seeing?
TOROW returned an error#SPILL!
Move the formula to a column with more horizontal space (like column A in an empty area below your table), or reduce the array size by using a smaller input range.
#VALUE!
Verify the array reference is a valid range (like A2:F5, not A2:F5:G6), and check that ignore is 0/1/2 and scan_by_column is TRUE/FALSE.
#N/A
Set ignore=2 to skip error values, or clean the source data to remove errors before calling TOROW.
ErrorWhy it happensHow to fix it
#SPILL!The resulting row array is too wide to fit in the available space to the right of the formula cell.Move the formula to a column with more horizontal space (like column A in an empty area below your table), or reduce the array size by using a smaller input range.
#VALUE!The array argument is invalid (e.g., not a proper range reference) or the ignore/scan_by_column parameters are the wrong data type.Verify the array reference is a valid range (like A2:F5, not A2:F5:G6), and check that ignore is 0/1/2 and scan_by_column is TRUE/FALSE.
#N/AThe array contains error values (like #N/A or #REF!) and the ignore parameter is not set to 2, so TOROW cannot flatten it.Set ignore=2 to skip error values, or clean the source data to remove errors before calling TOROW.

Tips and when to use something else

  • Use ignore=1 to automatically remove blank cells from HR data, contact lists, or inventory tables before flattening.
  • TOROW(array,,TRUE) roughly reverses a row-by-row scan into a column-by-column scan; it is not the same as TRANSPOSE, which preserves row/column structure.
  • If you need the result as text in a single cell rather than a spilled array, wrap TOROW in ARRAYTOTEXT: =ARRAYTOTEXT(TOROW(...)).
  • For a vertical column instead of a horizontal row, use TOCOL instead of TOROW.

Frequently asked questions

Can TOROW flatten a table with errors or missing data?
Yes. Use ignore=1 to skip blanks, or ignore=2 to skip errors. If you don't set ignore, errors will propagate into the result and cause #N/A.
How is TOROW different from HSTACK or VSTACK?
HSTACK and VSTACK concatenate multiple arrays side-by-side or top-to-bottom and preserve structure; TOROW flattens a single array into a single row, losing its original shape.
Does TOROW work with vertical data or only horizontal tables?
TOROW works on any array shape (vertical columns, horizontal rows, or 2D tables). It always outputs a single horizontal row regardless of input shape.
What happens if I set both ignore and scan_by_column?
Both parameters work together. ignore=1 removes blanks while scan_by_column=TRUE changes the order from row-wise to column-wise. Both are applied to the same flattening operation.

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