Xlambda
Well-known Member
- Joined
- Mar 8, 2021
- Messages
- 860
- Office Version
- 365
- Platform
- Windows
MP MAP's multiple arguments Expander.
MP can expand all its array arguments into arrays that will have same dimensions, and index them using "n" .
If initial array arguments are MAP friendly, the expander will turn them into MAP proper arrays.
MP can enhance any MAP expression that deals with multiple array arguments, to work with MAP friendly arrays of different dimensions.
syntax example that reflects MP functionality
F(x,y,z)=........MAP(x, y, z, LAMBDA(......
if x,y,z are arrays of different dimensions MAP(x,y,z will not work. => will use MP
F(x,y,z)=......MAP(MP(1,x,y,z),MP(2,x,y,z),MP(3,x,y,z),LAMBDA(.......
MP can expand all its array arguments into arrays that will have same dimensions, and index them using "n" .
If initial array arguments are MAP friendly, the expander will turn them into MAP proper arrays.
MP can enhance any MAP expression that deals with multiple array arguments, to work with MAP friendly arrays of different dimensions.
syntax example that reflects MP functionality
F(x,y,z)=........MAP(x, y, z, LAMBDA(......
if x,y,z are arrays of different dimensions MAP(x,y,z will not work. => will use MP
F(x,y,z)=......MAP(MP(1,x,y,z),MP(2,x,y,z),MP(3,x,y,z),LAMBDA(.......
Excel Formula:
=LAMBDA(n, a, b, [c], [d],
LET(
w, MAX(ROWS(a), ROWS(b), IFERROR(ROWS(c), 0), IFERROR(ROWS(d), 0)),
l, MAX(COLUMNS(a), COLUMNS(b), IFERROR(COLUMNS(c), 0), IFERROR(COLUMNS(d), 0)),
p, LAMBDA(x, IFNA(EXPAND(x, w, l), x)),
SWITCH(n, 1, p(a), 2, p(b), 3, p(c), 4, p(d))
)
)
MAPS.xlsx | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | M | N | |||
1 | Concept. MAP friendly arrays explained using DATE function. | |||||||||||||||
2 | ||||||||||||||||
3 | All arguments in DATE(y,m,d) can deal with arrays. | |||||||||||||||
4 | Any array distribution that makes DATE to deliver consistent result => are good examples of MAP friendly arrays | |||||||||||||||
5 | By default, any arrays that have same dimensions are MAP friendly. | |||||||||||||||
6 | examples of MAP friendly arrays: | |||||||||||||||
7 | ||||||||||||||||
8 | y | m | d | =DATE(B9:B11,D9:F9,H9) | ||||||||||||
9 | 2020 | 8 | 9 | 10 | 1 | 01-08-20 | 01-09-20 | 01-10-20 | ||||||||
10 | 2021 | 01-08-21 | 01-09-21 | 01-10-21 | ||||||||||||
11 | 2022 | 01-08-22 | 01-09-22 | 01-10-22 | ||||||||||||
12 | ||||||||||||||||
13 | ||||||||||||||||
14 | y | m | d | =DATE(B15,D15:F15,H15:H18) | ||||||||||||
15 | 2022 | 8 | 9 | 10 | 1 | 01-08-22 | 01-09-22 | 01-10-22 | ||||||||
16 | 2 | 02-08-22 | 02-09-22 | 02-10-22 | ||||||||||||
17 | 3 | 03-08-22 | 03-09-22 | 03-10-22 | ||||||||||||
18 | 4 | 04-08-22 | 04-09-22 | 04-10-22 | ||||||||||||
19 | ||||||||||||||||
20 | ||||||||||||||||
21 | y | m | d | =DATE(B22:B24,D22:D24,H22) | ||||||||||||
22 | 2020 | 8 | 1 | 01-08-20 | ||||||||||||
23 | 2021 | 9 | 2 | 01-09-21 | ||||||||||||
24 | 2022 | 10 | 3 | 01-10-22 | ||||||||||||
25 | ||||||||||||||||
26 | ||||||||||||||||
27 | y | m | d | =DATE(B28:B30,D28,H28) | ||||||||||||
28 | 2020 | 9 | 15 | 15-09-20 | ||||||||||||
29 | 2021 | 15-09-21 | ||||||||||||||
30 | 2022 | 15-09-22 | ||||||||||||||
31 | ||||||||||||||||
32 | ||||||||||||||||
33 | y | m | d | =DATE(B34:B37,D34:F34,H34:H37) | ||||||||||||
34 | 2020 | 8 | 9 | 10 | 1 | 01-08-20 | 01-09-20 | 01-10-20 | ||||||||
35 | 2021 | 2 | 02-08-21 | 02-09-21 | 02-10-21 | |||||||||||
36 | 2022 | 3 | 03-08-22 | 03-09-22 | 03-10-22 | |||||||||||
37 | 2023 | 4 | 04-08-23 | 04-09-23 | 04-10-23 | |||||||||||
38 | ||||||||||||||||
39 | ||||||||||||||||
40 | y | m | =DATE(B41:B44,D41:F41,D44:F44) | |||||||||||||
41 | 2020 | 8 | 9 | 10 | 01-08-20 | 02-09-20 | 03-10-20 | |||||||||
42 | 2021 | 01-08-21 | 02-09-21 | 03-10-21 | ||||||||||||
43 | 2022 | d | 01-08-22 | 02-09-22 | 03-10-22 | |||||||||||
44 | 2023 | 1 | 2 | 3 | 01-08-23 | 02-09-23 | 03-10-23 | |||||||||
45 | ||||||||||||||||
46 | ||||||||||||||||
47 | y | m | d | =DATE(B48:C50,E48:F50,H48:I50) | ||||||||||||
48 | 2018 | 2021 | 7 | 10 | 1 | 2 | 01-07-18 | 02-10-21 | ||||||||
49 | 2019 | 2021 | 8 | 11 | 3 | 4 | 03-08-19 | 04-11-21 | ||||||||
50 | 2020 | 2022 | 9 | 12 | 5 | 6 | 05-09-20 | 06-12-22 | ||||||||
51 | ||||||||||||||||
52 | ||||||||||||||||
53 | examples of MAP unfriendly arrays | |||||||||||||||
54 | ||||||||||||||||
55 | y | m | d | =DATE(B56:B58,D56:F56,H56:H57) | ||||||||||||
56 | 2020 | 8 | 9 | 10 | 1 | 01-08-20 | 01-09-20 | 01-10-20 | ||||||||
57 | 2021 | 2 | 02-08-21 | 02-09-21 | 02-10-21 | |||||||||||
58 | 2022 | #N/A | #N/A | #N/A | ||||||||||||
59 | ||||||||||||||||
60 | ||||||||||||||||
61 | y | m | d | =DATE(B62:B65,D62:F63,H62:H65) | ||||||||||||
62 | 2020 | 6 | 7 | 8 | 1 | 01-06-20 | 01-07-20 | 01-08-20 | ||||||||
63 | 2021 | 8 | 9 | 10 | 2 | 02-08-21 | 02-09-21 | 02-10-21 | ||||||||
64 | 2022 | 3 | #N/A | #N/A | #N/A | |||||||||||
65 | 2023 | 4 | #N/A | #N/A | #N/A | |||||||||||
66 | ||||||||||||||||
MP 1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
K8,K61,K55,K47,K40,K33,K27,K21,K14 | K8 | =FORMULATEXT(K9) |
K9:M11 | K9 | =DATE(B9:B11,D9:F9,H9) |
K15:M18 | K15 | =DATE(B15,D15:F15,H15:H18) |
K22:K24 | K22 | =DATE(B22:B24,D22:D24,H22) |
K28:K30 | K28 | =DATE(B28:B30,D28,H28) |
K34:M37 | K34 | =DATE(B34:B37,D34:F34,H34:H37) |
K41:M44 | K41 | =DATE(B41:B44,D41:F41,D44:F44) |
K48:L50 | K48 | =DATE(B48:C50,E48:F50,H48:I50) |
K56:M58 | K56 | =DATE(B56:B58,D56:F56,H56:H57) |
K62:M65 | K62 | =DATE(B62:B65,D62:F63,H62:H65) |
Dynamic array formulas. |
Upvote
0