FLIPARRAYV

=FLIPARRAYV(Array)

Array
Required.

Flip array vertically, top to bottom.

GeertD

Board Regular
Joined
Dec 22, 2020
Messages
60
Office Version
  1. 365
Platform
  1. Windows
FLIPARRAYV: Flip array vertically, top to bottom.
Excel Formula:
=LAMBDA(A,LET(
   RowsA,ROWS(A),ColsA,COLUMNS(A),
   INDEX(A,SEQUENCE(RowsA,,RowsA,-1),SEQUENCE(,ColsA))
))
DXLR's LAMBDA.LET Library_v00.07.xlsb
ABCD
1111
2222
3333
4
5333
6222
7111
8
Sandbox_Mr.Excel
Cell Formulas
RangeFormula
A5:C7A5=FlipArrayV(A1:C3)
Dynamic array formulas.
 
Upvote 0
Wouldn't multiplying the array by an exchange matrix be faster? That was my theory when I made my own array flipping functions. (but it does require a helper function)

ExchangeMatrix:
Excel Formula:
=LAMBDA(n,MAKEARRAY(n,n,LAMBDA(i,j,--(j=(n-i+1))))

ReverseRows:
Excel Formula:
=LAMBDA(Rng,MMULT(ExchangeMatrix(ROWS(Rng)),Rng)

ReverseCols:
Excel Formula:
=LAMBDA(Rng,MMULT(Rng,ExchangeMatrix(COLUMNS(Rng)))
 
Do you get other usage from ExchangeMatrix? I tried mimicking Python numpy.flipud and numpy.fliplr using just MAKEARRAY, logic is similar. If no other uses for ExchangeMatrix, just build the logic into the function?

aFlipUD - vertical
Excel Formula:
=LAMBDA(array,
    LET(
        rows_,ROWS(array),
        cols_,COLUMNS(array),
        MAKEARRAY(
            rows_,
            cols_,
            LAMBDA(i,j,INDEX(array,rows_-(i-1),j))
        )
    )
)

aFlipLR - horizontal
Excel Formula:
=LAMBDA(array,
    LET(
        rows_,ROWS(array),
        cols_,COLUMNS(array),
        MAKEARRAY(
            rows_,
            cols_,
            LAMBDA(i,j,INDEX(array,i,cols_-(j-1)))
        )
    )
)
 
Also forgot, MAKEARRAY wasn't available back in April just yet.
 
Wouldn't multiplying the array by an exchange matrix be faster? That was my theory when I made my own array flipping functions. (but it does require a helper function)
I don't think so.
My formula is a simple INDEX selection function that is subsequently "broadcast" (MS-speak that I like to call "perpendicular vectorization").
For short: a broadcasted Index-selection approach.
Mind you: there is NO lookup (that's what (x)match does, and I don't use that).
MMULT requires a full matrix multiplication (whether the elements are zero or not).
Although MMULT can be simple to use and very useful, in general that is not the most efficient way of calculating things.
IMO, anyway. of course you can always test it. :-)
Also [tboulden], using MAKEARRAY where you iterate a LAMBDA in which there is an INDEX function...
...sounds a little convoluted to me. No offence. :)
 
Also [tboulden], using MAKEARRAY where you iterate a LAMBDA in which there is an INDEX function...
...sounds a little convoluted to me. No offence.

Yeah, I'd love to know the relative efficiencies of various approaches; depending on how MAKEARRAY is implemented, it may just be lifting the function over the row-index and column-index arrays as opposed to "iterating" over them, similar to MAP(array_1,array_2,LAMBDA(x,y,...)), which I think INDEX probably does something like this natively in the first place.
 
Yeah, I'd love to know the relative efficiencies of various approaches; depending on how MAKEARRAY is implemented, it may just be lifting the function over the row-index and column-index arrays as opposed to "iterating" over them, similar to MAP(array_1,array_2,LAMBDA(x,y,...)), which I think INDEX probably does something like this natively in the first place.
Well, as I understand from both the MR.Excel video and his book "Excel: Dynamic Arrays – StraightToThePoint": "lifting" is what WE do to INDEX (in this case) by vectorizing one of its scalar arguments.
That's as close as "native" as we can get, IMO. ;-)
 

Forum statistics

Threads
1,224,829
Messages
6,181,218
Members
453,024
Latest member
Wingit77

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top