schardt679
Board Regular
- Joined
- Mar 27, 2021
- Messages
- 58
- Office Version
- 365
- 2010
- Platform
- Windows
- Mobile
- Web
AFLIP returns an array in reverse horizontal order, vertical order, or both.
Thanks to GeertD's FLIPARRAYH & FLIPARRAYV functions and Chandoo's How to REVERSE data in Excel with Formulas (3 tricks) for the inspiration.
Calls IFBLANK & CELLCOUNT.
Other functions on minisheet: AFORMULATEXT.
Screen Tip/ Comment: =AFLIP(Array☛ range to flip order, [Direction]☛ 0/=horizontally; 1=vertically; 2=both) ⁂[]=optional; =default; =omit
Thanks to GeertD's FLIPARRAYH & FLIPARRAYV functions and Chandoo's How to REVERSE data in Excel with Formulas (3 tricks) for the inspiration.
Calls IFBLANK & CELLCOUNT.
Other functions on minisheet: AFORMULATEXT.
Screen Tip/ Comment: =AFLIP(Array☛ range to flip order, [Direction]☛ 0/=horizontally; 1=vertically; 2=both) ⁂[]=optional; =default; =omit
Excel Formula:
=LAMBDA(Array,[Direction],
LET(Arr, IFBLANK(Array, ""), Dir, IFERROR(--(Direction), 3),
DirScan, AND(Dir<>{2,1,0}), DirMSG, "Direction=0,1,2",
RowCt, CELLCOUNT(Arr, 1), RowSeq, SORT(SEQUENCE(RowCt),, IF(Dir=0, 1, -1)),
ColCt, CELLCOUNT(Arr, 2), ColSeq, SORT(SEQUENCE(, ColCt),, IF(Dir=1, 1, -1), 1),
Result, INDEX(Arr, RowSeq, ColSeq), Return, IF(DirScan, DirMSG, Result),
Return
)
)
LAMBDA Examples.xlsx | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | |||
1 | AFLIP | ||||||||||||
2 | |||||||||||||
3 | Original Data | Direction | Result | ||||||||||
4 | Product | Sales | Date | Date | Sales | Product | |||||||
5 | Pepper Deseeder | 19 | 03/22/21 | 03/22/21 | 19 | Pepper Deseeder | |||||||
6 | Knife Set | 4 | 03/22/21 | 03/22/21 | 4 | Knife Set | |||||||
7 | Cutting Board | 7 | 03/22/21 | 03/22/21 | 7 | Cutting Board | |||||||
8 | Pepper Deseeder | 26 | 03/23/21 | 03/23/21 | 26 | Pepper Deseeder | |||||||
9 | Knife Set | 28 | 03/23/21 | 03/23/21 | 28 | Knife Set | |||||||
10 | Cutting Board | 16 | 03/23/21 | 03/23/21 | 16 | Cutting Board | |||||||
11 | Pepper Deseeder | 03/24/21 | 03/24/21 | Pepper Deseeder | |||||||||
12 | |||||||||||||
13 | Array is flipped horizontally | ||||||||||||
14 | Formula in cell H4☛ =AFLIP(B4:D11, F4) | ||||||||||||
15 | |||||||||||||
16 | |||||||||||||
17 | |||||||||||||
18 | Original Data | Direction | Result | ||||||||||
19 | Product | Sales | Date | 1 | Pepper Deseeder | 03/24/21 | |||||||
20 | Pepper Deseeder | 19 | 03/22/21 | Cutting Board | 16 | 03/23/21 | |||||||
21 | Knife Set | 4 | 03/22/21 | Knife Set | 28 | 03/23/21 | |||||||
22 | Cutting Board | 7 | 03/22/21 | Pepper Deseeder | 26 | 03/23/21 | |||||||
23 | Pepper Deseeder | 26 | 03/23/21 | Cutting Board | 7 | 03/22/21 | |||||||
24 | Knife Set | 28 | 03/23/21 | Knife Set | 4 | 03/22/21 | |||||||
25 | Cutting Board | 16 | 03/23/21 | Pepper Deseeder | 19 | 03/22/21 | |||||||
26 | Pepper Deseeder | 03/24/21 | Product | Sales | Date | ||||||||
27 | |||||||||||||
28 | Array is flipped vertically | ||||||||||||
29 | Formula in cell H19☛ =AFLIP(B19:D26, F19) | ||||||||||||
30 | |||||||||||||
31 | |||||||||||||
32 | Original Data | Direction | Result | ||||||||||
33 | Product | Sales | Date | 2 | 03/24/21 | Pepper Deseeder | |||||||
34 | Pepper Deseeder | 19 | 03/22/21 | 03/23/21 | 16 | Cutting Board | |||||||
35 | Knife Set | 4 | 03/22/21 | 03/23/21 | 28 | Knife Set | |||||||
36 | Cutting Board | 7 | 03/22/21 | 03/23/21 | 26 | Pepper Deseeder | |||||||
37 | Pepper Deseeder | 26 | 03/23/21 | 03/22/21 | 7 | Cutting Board | |||||||
38 | Knife Set | 28 | 03/23/21 | 03/22/21 | 4 | Knife Set | |||||||
39 | Cutting Board | 16 | 03/23/21 | 03/22/21 | 19 | Pepper Deseeder | |||||||
40 | Pepper Deseeder | 03/24/21 | Date | Sales | Product | ||||||||
41 | |||||||||||||
42 | Array is flipped both horizontally and vertically | ||||||||||||
43 | Formula in cell H33☛ =AFLIP(B33:D40, F33) | ||||||||||||
44 | |||||||||||||
AFLIP |
Cell Formulas | ||
---|---|---|
Range | Formula | |
H4:J11,H33:J40,H19:J26 | H4 | =AFLIP(B4:D11, F4) |
B14,B43,B29 | B14 | =AFORMULATEXT(H4) |
Dynamic array formulas. |
Upvote
0