Search code examples
google-sheetslambdarowsequencetranspose

How to flip a range horizontally?


I have this google sheets input table
How to flip the range A2:E range horizontally with Arrayformula because the range A1:E is growing.

Input                   Output              
c   a   t                       t   a   c
b   i   r   d               d   r   i   b
h   o   r   s   e       e   s   r   o   h
t   i   g   e   r       r   e   g   i   t

Solution

  • The old way

    =TRANSPOSE(SORT(TRANSPOSE(A2:E),SEQUENCE(ROWS(
                    TRANSPOSE(A2:E))),0))
    

    enter image description here

    The new way

    =LAMBDA(range,
     TRANSPOSE(SORT(range,SEQUENCE(ROWS(range)),0)))(TRANSPOSE(A2:E))
    

    enter image description here

    Used formulas help
    TRANSPOSE - SORT - SEQUENCE - ROWS - LAMBDA