AFLIP

AFLIP(a,[f])
a
array
[f]
flip argument ; 0 or omitted, flips horiz. ; 1, flips vert. ; 2, flips horiz. and vert.

flips an array horizontally and/or vertically

Xlambda

Well-known Member
Joined
Mar 8, 2021
Messages
832
Office Version
  1. 365
Platform
  1. Windows
AFLIP flips an array horizontally and/or vertically. Does not call any other lambda.
VBA Code:
=LAMBDA(a,[f],
    LET(r,ROWS(a),c,COLUMNS(a),sr,SEQUENCE(r),sc,SEQUENCE(,c),
      x,IF(f,ABS(sr-r-1),sr),y,IF(f=1,sc,ABS(sc-c-1)),
      INDEX(IF(a="","",a),x,y)
    )
)
Book1
ABCDEFGHIJKLMNOPQRST
1samplef,omitted
212345=AFLIP(A2:E5)if f <>(0,1,2) array flips both directions
36781054321f,3
41113141510876=AFLIP(A2:E5,3)
51617181920151413112019181716
6201918171615141311
710876
8f,154321
9=AFLIP(A2:E5,1)
101617181920
1111131415
1267810
1312345
14
15f,2
16=AFLIP(A2:E5,2)
172019181716
1815141311
1910876
2054321
21
Sheet1
Cell Formulas
RangeFormula
G2,G16,G9,M4G2=FORMULATEXT(G3)
G3:K6G3=AFLIP(A2:E5)
M5:Q8M5=AFLIP(A2:E5,3)
G10:K13G10=AFLIP(A2:E5,1)
G17:K20G17=AFLIP(A2:E5,2)
Dynamic array formulas.
 
Upvote 0
If we need the charts stacked horizontally or vertically.
NWAW(m,v,r,c,[txt],[o])
m: max value
v: value or array of values
r: rows of each waffle chart
c: clms of each waffle chart
[txt]: labels text
[o]: orientation argument, if omitted or 0 displayed horizontally, if 1 or <>0 vertically
Excel Formula:
=LAMBDA(m,v,r,c,[txt],[o],
    LET(
        n, COUNT(v),
        REDUCE(n & " charts",SEQUENCE(n),
            LAMBDA(k,i,
                LET(
                    x, INDEX(v, i),
                    y, DROP(WAF(m, x, r, c, txt), , -1),
                    IFNA(IF(o,VSTACK(k, HSTACK("Waf." & i, y), ""),HSTACK(k, "Waf." & i, y, "")),"")
                )
            )
        )
    )
)
Waffle Chart.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAO
1o,omitted=>charts displayed horizontally
2=NWAF(200,{53,147,105},20,10,"lbs")
3↓↓↓
43 chartsWaf.153 lbsWaf.2147 lbsWaf.3105 lbs
5
6
7
8
91111111
101111111111
111111111111
121111111111
13111111111111111
1411111111111111111111
1511111111111111111111
1611111111111111111111
1711111111111111111111
1811111111111111111111111
19111111111111111111111111111111
20111111111111111111111111111111
21111111111111111111111111111111
22111111111111111111111111111111
23111111111111111111111111111111
24
Waffle 3
Cell Formulas
RangeFormula
B2B2=FORMULATEXT(B4)
B4:AO23B4=NWAF(200,{53,147,105},20,10,"lbs")
Dynamic array formulas.
 
Waffle Chart.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAAB
1o,1=> charts displayed vertically
2=NWAF(200,{53,147,105},20,10,"lbs",1)all in one
33 charts=WAF(200,{53,147,105},20,10,"lbs")
4Waf.153 lbs 53 lbs1
5105 lbs2
6147 lbs3
7
8
93333333
103333333333
113333333333
123333333333
132222233333
142222222222
152222222222
162222222222
172222222222
181111112222222
1911111111111111111111
2011111111111111111111
2111111111111111111111
2211111111111111111111
2311111111111111111111
24
25Waf.2147 lbs
26
27
28
29
301111111
311111111111
321111111111
331111111111
341111111111
351111111111
361111111111
371111111111
381111111111
391111111111
401111111111
411111111111
421111111111
431111111111
441111111111
45
46Waf.3105 lbs
47
48
49
50
51
52
53
54
5511111
561111111111
571111111111
581111111111
591111111111
601111111111
611111111111
621111111111
631111111111
641111111111
651111111111
66
Waffle 4
Cell Formulas
RangeFormula
B2,O3B2=FORMULATEXT(B3)
B3:M66B3=NWAF(200,{53,147,105},20,10,"lbs",1)
O4:Z23O4=WAF(200,{53,147,105},20,10,"lbs")
Dynamic array formulas.
 
Screen capture insert (to many cells for minisheet)
Same display like in Chandoo's example, single cell formula plus some text boxes
nwaf.png
 

Forum statistics

Threads
1,215,443
Messages
6,124,890
Members
449,194
Latest member
JayEggleton

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