Dynamic arrays
TOROW function: flatten a 2D block into a single horizontal header or tag row
Convert a multi-row grid of SKU codes or tags into one horizontal row with TOROW and TRANSPOSE.
Generate horizontal column headers from a 2D matrix
TOROW(array) is the horizontal twin of TOCOL: it unrolls a multi-row range row-by-row into a 1-row dynamic array across columns.
Combining TOROW with COUNTA(A2:B3) or TEXTJOIN(", ", TRUE, TOROW(A2:B3)) cleanly summarizes only populated SKU tags.
| BinA (A) | BinB (B) |
|---|---|
| SKU-10 | SKU-20 |
| SKU-30 | SKU-40 |
Compare row-major vs column-major horizontal output
TOROW(A2:B3) scans across row 2 then row 3 (SKU-10, SKU-20, SKU-30, SKU-40). Wrapping the source block in TRANSPOSE—TOROW(TRANSPOSE(A2:B3))—scans down column A first (SKU-10, SKU-30, SKU-20, SKU-40).
=TEXTJOIN(", ", TRUE, TOROW(A2:B3))Count resulting horizontal slots and index items
COLUMNS(TOROW(A2:B3)) returns all 4 horizontal columns of the unrolled 2x2 grid, while INDEX(TOROW(A2:B3), 1, 3) picks the 3rd horizontal tag (SKU-30).
=COLUMNS(TOROW(A2:B3))Try the example
Use the original values or change them to test your understanding.