This is an old question, but also a very common one, and I haven't seen any answers that I like, on SO or elsewhere. That may of course be because my searches have been insufficiently diligent.
Create a named function called, say, REVERSE_COLUMN
, and define it like this:
=SORT(col,SEQUENCE(ROWS(col)),FALSE)
If you haven't done this before, you will find it at Data | Named functions | Add new function. It will look like this:
Then you can call the function like this =REVERSE_COLUMN(A1:A10)
.
If you pass it a rectangular block of cells instead of a single column (like A1:C10
) it will do what you probably expect: it will treat every row in the block as a unit and will reverse the block row-wise. Or, if you prefer to think of it that way, it will take every column in the block and reverse it individually.
That behaviour, which I consider reasonable, gives rise to the one known issue, that for my purposes was not worth fixing: The function will appear to do nothing, and will not warn you, if passed a row rather than a column. That is because it treats its input as a column consisting of a single row, with several cells in that row, and reversing a the order of a column with only one row yields the identical column with only one row.
If that is troublesome, define a second function REVERSE_ROW
like this:
=Transpose(SORT(Transpose(row), SEQUENCE(COLUMNS(row)), FALSE))
This technique works equally well with arrays. Just remember that the array corresponding to a single column of cells looks like this: {1;2;3;4;5;6;7;8}
while the array corresponding to a single row of cells looks like this: {1,2,3,4,5,6,7,8}
, and built-in functions that return an array may return a row when you might expect a column.