Row-wise reading order
| A | B | |
|---|---|---|
| 1 | a | b |
| 2 | c | d |
Formula: D1: =TEXTJOIN(",",,TOROW(A1:B2))
Result: a,b,c,d
The default scan goes along the first row and then the second.
TOROW with worked examples you can test in the live grid. The argument details are in the Excel guide.
The arguments and common errors are covered in the TOROW Excel guide; check the function help in Google Sheets for its own argument list.
| A | B | |
|---|---|---|
| 1 | a | b |
| 2 | c | d |
Formula: D1: =TEXTJOIN(",",,TOROW(A1:B2))
Result: a,b,c,d
The default scan goes along the first row and then the second.
| A | B | |
|---|---|---|
| 1 | a | b |
| 2 | c | d |
Formula: D1: =TEXTJOIN(",",,TOROW(A1:B2,,TRUE))
Result: a,c,b,d
With scan_by_column TRUE the result runs down the first column and then the second.
| A | B | |
|---|---|---|
| 1 | 1 | =NA() |
| 2 | 3 | 4 |
Formula: D1: =SUM(TOROW(A1:B2,3))
Result: 8
The ignore code 3 removes the #N/A, so the other three numbers add up to 8.
A tiny spreadsheet with example data. Edit the formula or any number and see the result.
Formula in F2: =TOROW(C2:C5)
| A | B | C | D | E | F | G | H | I | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | Region | Product | Units | Price | Result | ||||
| 2 | East | Pen | 120 | 2.5 | 120 | 80 | 45 | 60 | |
| 3 | West | Pen | 80 | 2.5 | |||||
| 4 | East | Book | 45 | 12 | |||||
| 5 | North | Book | 60 | 12 | |||||
| 6 | West | Lamp | 30 | 25 | |||||
| 7 | East | Lamp | 15 | 25 |
Google Sheets is used here only as a descriptive product name. FormulaCamp is not affiliated with Google.
Enter — commit · F2 — edit · F4 — $ in a reference · Ctrl+C/Ctrl+V — copy and paste · Ctrl+Z — undo
Esc or F6 — leave the sheet for the «Check» button · Shift+Tab in the first cell — back to the page