Example 1
Flatten a grid into one row
A6 =TOROW(A2:C4)
Result: 10, 20, 30, 40, 50, 60, 70, 80, 90
The nine cells come out in reading order: row 1 left to right, then row 2, then row 3.
A6 =TOROW(A2:C4) returns 10, 20, 30, 40, 50, 60, 70, 80, 90
Turns a range or array into a single row, optionally skipping blanks and errors.
Syntax
=TOROW(, , )
Excel for Microsoft 365, Excel 2024 and later, and Excel for the web. Not available in Excel 2021 or earlier.
Try it
Edit the formula in A6 or change the inputs. The sheet recalculates as you type.
A6 =TOROW(A2:C4) returns 10, 20, 30, 40, 50, 60, 70, 80, 90
TOROW lays a block of cells out as a single row. It is the horizontal twin of TOCOL, and the quickest way to turn a vertical list into headers or to stretch a table into one line.
0 keeps everything. 1 skips empty cells. 2 skips errors. 3 skips both.TRUE it reads the first column from top to bottom, then the second column.=TOROW(A2:C4) returns 10, 20, 30, 40 and on across one row. =TOROW(A2:C4,,TRUE) returns 10, 40, 70, 20 and on.
The most common use is to turn a list down a column into column headings across a report. The list of regions in a sales log has repeats, so first remove them:
=TOROW(UNIQUE(B2:B6))
The result is North, South, East across one row. If a new region appears in the data, the headings grow with it. Add SORT in the middle for alphabetical headings: =TOROW(SORT(UNIQUE(B2:B6))).
This is an alternative to TRANSPOSE for one-column lists. TRANSPOSE changes the orientation of a block and keeps its shape. TOROW always gives one row, however big the source is, and it can skip blanks and errors.
TOROW is useful when a function needs a single row, such as the headings of a spill or the argument of TEXTJOIN. =TEXTJOIN(", ",TRUE,TOROW(A2:C4)) joins every item in the grid, although TEXTJOIN also accepts the grid directly.
Skipping blanks and errors removes the gaps before the result is used, which is handy when you build a row of values to chart or to join. =TOROW(A2:C4,3) returns only the cells that hold real values.
If the ignore option removes everything, the result is #CALC!. Blank cells return 0 unless you skip them. The row spills to the right of the formula, so the cells to its right must be empty or you get #SPILL!. Refer to the whole row with the # operator: =COUNTA(F1#). See FILTER.
To go the other way, fold a row or column back into a grid with WRAPROWS or WRAPCOLS.
TOROW needs Microsoft 365, Excel 2024 or later, or Excel for the web.
A2:C4.0 keeps everything, and is the default. 1 skips blank cells. 2 skips errors. 3 skips both blanks and errors.FALSE, the default, reads the array across each row, left to right, then moves down. TRUE reads down each column, then moves right.Each example is a live sheet. Change the inputs or the formula and watch the result.
Example 1
A6 =TOROW(A2:C4)
Result: 10, 20, 30, 40, 50, 60, 70, 80, 90
The nine cells come out in reading order: row 1 left to right, then row 2, then row 3.
A6 =TOROW(A2:C4) returns 10, 20, 30, 40, 50, 60, 70, 80, 90
Example 2
A6 =TOROW(A2:C4,,TRUE)
Result: 10, 40, 70, 20, 50, 80, 30, 60, 90
The empty second argument keeps the default ignore setting. TRUE as the third reads the first column down, then the second, then the third.
A6 =TOROW(A2:C4,,TRUE) returns 10, 40, 70, 20, 50, 80, 30, 60, 90
Example 3
A8 =TOROW(UNIQUE(B2:B6))
Result: North, South, East
UNIQUE returns North, South and East once each, and TOROW lays them across a row.
A8 =TOROW(UNIQUE(B2:B6)) returns North, South, East
Example 4
A8 =TOROW(SORT(UNIQUE(B2:B6)))
Result: East, North, South
SORT puts the distinct regions in order before TOROW lays them out. Add a new region to the log and a new heading appears.
A8 =TOROW(SORT(UNIQUE(B2:B6))) returns East, North, South
Solve it in the sheet. Every answer is checked, with hints if you need them.
Task 1 of 2
In D2, show each team once, across a single row, in the order the teams first appear in column B.
Answer in D2.
#SPILL!. Clear the cells to its right or move the formula.ignore to 1 or 3.array puts that text into the row. Start the range at the first data cell.#CALC! means nothing is left after the ignore option. Check that the source has values.Use `=TOROW(A2:A6)`. It is also possible with TRANSPOSE, but TOROW can skip blanks and errors and always returns one row.
Combine UNIQUE and TOROW: `=TOROW(UNIQUE(B2:B50))`. Put SORT in the middle if you want alphabetical headings.
TRANSPOSE swaps rows and columns and keeps the shape of the data. TOROW flattens any array into one row, with options to skip blanks and errors and to choose the reading order.
Set the second argument to 1: `=TOROW(A2:C4,1)`. Use 3 to skip errors as well.
No. It is available in Microsoft 365, Excel 2024 and later, and Excel for the web. Earlier versions return `#NAME?`.
Tracks take you from the basics to modelling, one graded exercise at a time.