Dynamic Arrays & Spill
Flip Table Rows Upside-Down in Exact Reverse Order (SORTBY & SEQUENCE)
Invert any 1D list or multi-column 2D log table from bottom-to-top positional order—even when timestamps have ties or non-chronological text—using SORTBY(range, SEQUENCE(ROWS(range)), -1).
Reverse bank-statement or audit-log row order WITHOUT sorting alphabetically!
CSV exports from banks, Git commit logs, and manufacturing PLC historians often arrive oldest-at-top when your dashboard wants newest-at-top (or vice versa)—and if two transactions share the exact same date or have text descriptions, regular SORT(table, 1, -1) scrambles tied rows instead of preserving strict reverse positional order!
Generating a synthetic row-index vector 1, 2, ..., N via SEQUENCE(ROWS(A2:B5)) and feeding it as the sort-by key into SORTBY(A2:B5, SEQUENCE(ROWS(A2:B5)), -1) flips the entire multi-column table upside-down by pure row position: Row 4 moves to Row 1, Row 3 moves to Row 2, Row 2 moves to Row 3, and Row 1 moves to Row 4—regardless of data types, duplicate dates, or text labels!
| Original Row # | Original Ledger Entry (A2:B5) | Reverse Key (-1) | Flipped Output Position |
|---|---|---|---|
| Row 1 (Top) | TX-101 | $120 | Index 1 -> 4th | Moves to Bottom Row 4 |
| Row 2 | TX-102 | $250 | Index 2 -> 3rd | Moves to Row 3 |
| Row 3 | TX-103 | $180 | Index 3 -> 2nd | Moves to Row 2 |
| Row 4 (Bottom) | TX-104 | $410 | Index 4 -> 1st | Moves to Top Row 1! |
Preview Reversed First-Column Order via TEXTJOIN & SORTBY
Flips A2:A5 upside-down using SORTBY(..., SEQUENCE(ROWS(A2:A5)), -1) and joins IDs top-to-bottom.
=TEXTJOIN(", ", TRUE, SORTBY(A2:A5, SEQUENCE(ROWS(A2:A5)), -1))Extract N-th Row Value From the Upside-Down 2D Table
Flips the entire two-column table A2:B5 and retrieves Column 2 (Amount) at reversed row D2.
=IF(OR(D2 < 1, D2 > ROWS(A2:B5)), "Row Out of Bounds", INDEX(SORTBY(A2:B5, SEQUENCE(ROWS(A2:B5)), -1), D2, 2))Try the example
Use the original values or change them to test your understanding.