Xlambda
Well-known Member
- Joined
- Mar 8, 2021
- Messages
- 860
- Office Version
- 365
- Platform
- Windows
ASUMIFS !! recursive !! array sumifs alternative, that can handle array calculations as its arguments . calls T_IFS , APPEND2H
Other functions on minisheet: ADATE , ACOMBINE , ASELECT
Other functions on minisheet: ADATE , ACOMBINE , ASELECT
Excel Formula:
=LAMBDA(f,w,v,
LET(r,ROWS(w),n,COLUMNS(v),x,MMULT(T_IFS(f,w,),INDEX(v,,n)),
IF(n=1,APPEND2H(x,v,2),APPEND2H(ASUMIFS(f,w,INDEX(v,SEQUENCE(r),n-1)),x,))
)
)
LAMBDA 7.0.xlsx | |||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | AA | AB | AC | |||
1 | example that justifies the use of ASUMIFS (SUMIFS can not be used bcs of range argument), (quarterly amd monthly report) | quarterly report - single cell formula that uses only initial array, no helper arrays needed | |||||||||||||||||||||||||||||
2 | step 1 (transform date clm) | step 2 (grouping criteria) | step 3(report) | please imagine equivalent formula using SUMIFS ? (without helper arrays, no way) | |||||||||||||||||||||||||||
3 | sample "within array" | =ADATE(A4:E33,"q",) | =ACOMBINE(G4#,{1,2,3}) | =ASUMIFS(M4#,G4:I33,J4:K33) | =ASUMIFS(ACOMBINE(ADATE(A4:E33,"q",),{1,2,3}),ASELECT(ADATE(A4:E33,"q",),,,,3,),J4:K33) | ||||||||||||||||||||||||||
4 | 11-02-21 | A | x | 8 | 32 | 2021-Q1 | A | x | 8 | 32 | 2021-Q1 | A | x | 15 | 173 | 15 | 173 | single cell formula Z6: | =ASUMIFS(ACOMBINE(ADATE(A4:E33,"m",),{1,3}),ASELECT(ADATE(A4:E33,"m",),,,,,{1,3}),J4:K33) | ||||||||||||
5 | 05-07-21 | B | y | 3 | 24 | 2021-Q3 | B | y | 3 | 24 | 2021-Q1 | A | y | 0 | 0 | 0 | 0 | =ACOMBINE(ADATE(A4:E33,"m",),{1,3}) | monthly report for x,y - single cell formula | ||||||||||||
6 | 28-12-21 | C | y | 2 | 53 | 2021-Q4 | C | y | 2 | 53 | 2021-Q1 | B | x | 13 | 126 | 13 | 126 | 2021-01-Jan | x | 16 | 168 | ||||||||||
7 | 17-01-21 | C | x | 9 | 27 | 2021-Q1 | C | x | 9 | 27 | 2021-Q1 | B | y | 0 | 0 | 0 | 0 | 2021-01-Jan | y | 5 | 24 | ||||||||||
8 | 22-02-21 | C | x | 6 | 34 | 2021-Q1 | C | x | 6 | 34 | 2021-Q1 | C | x | 25 | 151 | 25 | 151 | 2021-02-Feb | x | 22 | 109 | ||||||||||
9 | 02-10-21 | B | y | 3 | 17 | 2021-Q4 | B | y | 3 | 17 | 2021-Q1 | C | y | 5 | 24 | 5 | 24 | 2021-02-Feb | y | 0 | 0 | ||||||||||
10 | 28-09-21 | A | y | 9 | 18 | 2021-Q3 | A | y | 9 | 18 | 2021-Q2 | A | x | 0 | 0 | 0 | 0 | 2021-03-Mar | x | 15 | 173 | ||||||||||
11 | 06-09-21 | A | y | 6 | 34 | 2021-Q3 | A | y | 6 | 34 | 2021-Q2 | A | y | 4 | 47 | 4 | 47 | 2021-03-Mar | y | 0 | 0 | ||||||||||
12 | 25-11-21 | C | y | 7 | 51 | 2021-Q4 | C | y | 7 | 51 | 2021-Q2 | B | x | 0 | 0 | 0 | 0 | 2021-04-Apr | x | 0 | 0 | ||||||||||
13 | 03-03-21 | B | x | 5 | 83 | 2021-Q1 | B | x | 5 | 83 | 2021-Q2 | B | y | 3 | 14 | 3 | 14 | 2021-04-Apr | y | 7 | 61 | ||||||||||
14 | 23-07-21 | B | x | 4 | 56 | 2021-Q3 | B | x | 4 | 56 | 2021-Q2 | C | x | 8 | 34 | 8 | 34 | 2021-05-May | x | 8 | 34 | ||||||||||
15 | 18-09-21 | A | y | 5 | 73 | 2021-Q3 | A | y | 5 | 73 | 2021-Q2 | C | y | 7 | 37 | 7 | 37 | 2021-05-May | y | 7 | 37 | ||||||||||
16 | 31-03-21 | C | x | 8 | 26 | 2021-Q1 | C | x | 8 | 26 | 2021-Q3 | A | x | 10 | 125 | 10 | 125 | 2021-07-Jul | x | 18 | 164 | ||||||||||
17 | 27-01-21 | A | x | 2 | 43 | 2021-Q1 | A | x | 2 | 43 | 2021-Q3 | A | y | 20 | 125 | 20 | 125 | 2021-07-Jul | y | 10 | 86 | ||||||||||
18 | 21-10-21 | B | x | 1 | 26 | 2021-Q4 | B | x | 1 | 26 | 2021-Q3 | B | x | 16 | 175 | 16 | 175 | 2021-08-Aug | x | 1 | 60 | ||||||||||
19 | 20-07-21 | B | x | 5 | 43 | 2021-Q3 | B | x | 5 | 43 | 2021-Q3 | B | y | 10 | 86 | 10 | 86 | 2021-08-Aug | y | 5 | 72 | ||||||||||
20 | 16-07-21 | B | y | 7 | 62 | 2021-Q3 | B | y | 7 | 62 | 2021-Q3 | C | x | 0 | 0 | 0 | 0 | 2021-09-Sep | x | 7 | 76 | ||||||||||
21 | 25-12-21 | C | y | 3 | 87 | 2021-Q4 | C | y | 3 | 87 | 2021-Q3 | C | y | 5 | 72 | 5 | 72 | 2021-09-Sep | y | 20 | 125 | ||||||||||
22 | 17-05-21 | C | x | 8 | 34 | 2021-Q2 | C | x | 8 | 34 | 2021-Q4 | A | x | 0 | 0 | 0 | 0 | 2021-10-Oct | x | 1 | 26 | ||||||||||
23 | 05-07-21 | A | x | 9 | 65 | 2021-Q3 | A | x | 9 | 65 | 2021-Q4 | A | y | 0 | 0 | 0 | 0 | 2021-10-Oct | y | 3 | 17 | ||||||||||
24 | 29-04-21 | B | y | 3 | 14 | 2021-Q2 | B | y | 3 | 14 | 2021-Q4 | B | x | 1 | 26 | 1 | 26 | 2021-11-Nov | x | 0 | 0 | ||||||||||
25 | 24-01-21 | A | x | 5 | 98 | 2021-Q1 | A | x | 5 | 98 | 2021-Q4 | B | y | 3 | 17 | 3 | 17 | 2021-11-Nov | y | 7 | 51 | ||||||||||
26 | 25-08-21 | A | x | 1 | 60 | 2021-Q3 | A | x | 1 | 60 | 2021-Q4 | C | x | 0 | 0 | 0 | 0 | 2021-12-Dec | x | 0 | 0 | ||||||||||
27 | 07-05-21 | C | y | 7 | 37 | 2021-Q2 | C | y | 7 | 37 | 2021-Q4 | C | y | 12 | 191 | 12 | 191 | 2021-12-Dec | y | 5 | 140 | ||||||||||
28 | 12-02-21 | B | x | 8 | 43 | 2021-Q1 | B | x | 8 | 43 | |||||||||||||||||||||
29 | 17-04-21 | A | y | 4 | 47 | 2021-Q2 | A | y | 4 | 47 | check: | =SUMIFS(J4:J33,G4:G33,M4:M27,H4:H33,N4:N27,I4:I33,O4:O27) | |||||||||||||||||||
30 | 21-01-21 | C | y | 5 | 24 | 2021-Q1 | C | y | 5 | 24 | =SUMIFS(K4:K33,G4:G33,M4:M27,H4:H33,N4:N27,I4:I33,O4:O27) | ||||||||||||||||||||
31 | 06-03-21 | C | x | 2 | 64 | 2021-Q1 | C | x | 2 | 64 | 15 | 173 | |||||||||||||||||||
32 | 27-09-21 | B | x | 7 | 76 | 2021-Q3 | B | x | 7 | 76 | 0 | 0 | |||||||||||||||||||
33 | 02-08-21 | C | y | 5 | 72 | 2021-Q3 | C | y | 5 | 72 | 13 | 126 | |||||||||||||||||||
34 | 0 | 0 | other functions on minisheet | ||||||||||||||||||||||||||||
35 | 25 | 151 | ASELECT | ||||||||||||||||||||||||||||
36 | sample | =ACOMBINE(A37:E51,{1,2,3}) | =ASUMIFS(ACOMBINE(A37:C51,),A37:C51,D37:E51) | 5 | 24 | ADATE | |||||||||||||||||||||||||
37 | B | c | x | 3 | 10 | A | a | x | 1 | 23 | 0 | 0 | ACOMBINE | ||||||||||||||||||
38 | A | a | x | 1 | 23 | A | a | y | 21 | 174 | 4 | 47 | |||||||||||||||||||
39 | B | b | x | 2 | 45 | A | b | x | 3 | 64 | 0 | 0 | |||||||||||||||||||
40 | A | c | y | 6 | 32 | A | b | y | 0 | 0 | 3 | 14 | |||||||||||||||||||
41 | B | b | y | 4 | 16 | A | c | x | 0 | 0 | 8 | 34 | |||||||||||||||||||
42 | B | b | x | 8 | 87 | A | c | y | 13 | 157 | 7 | 37 | |||||||||||||||||||
43 | A | a | y | 6 | 65 | B | a | x | 9 | 55 | 10 | 125 | |||||||||||||||||||
44 | A | c | y | 4 | 49 | B | a | y | 0 | 0 | 20 | 125 | |||||||||||||||||||
45 | B | b | y | 5 | 81 | B | b | x | 13 | 214 | 16 | 175 | |||||||||||||||||||
46 | A | b | x | 3 | 64 | B | b | y | 9 | 97 | 10 | 86 | |||||||||||||||||||
47 | B | a | x | 9 | 55 | B | c | x | 3 | 10 | 0 | 0 | |||||||||||||||||||
48 | A | c | y | 3 | 76 | B | c | y | 0 | 0 | 5 | 72 | |||||||||||||||||||
49 | B | b | x | 3 | 82 | 0 | 0 | ||||||||||||||||||||||||
50 | A | a | y | 8 | 90 | 0 | 0 | ||||||||||||||||||||||||
51 | A | a | y | 7 | 19 | 1 | 26 | ||||||||||||||||||||||||
52 | 3 | 17 | |||||||||||||||||||||||||||||
53 | Note: AGROUP easy to use formula will follow with the capability of | 0 | 0 | ||||||||||||||||||||||||||||
54 | compacting the whole reports in an array | 12 | 191 | ||||||||||||||||||||||||||||
55 | |||||||||||||||||||||||||||||||
ASUMIFS post |
Cell Formulas | ||
---|---|---|
Range | Formula | |
G3,R30,W5,M3,Q3,T3 | G3 | =FORMULATEXT(G4) |
G4:K33 | G4 | =ADATE(A4:E33,"q",) |
M4:O27 | M4 | =ACOMBINE(G4#,{1,2,3}) |
Q4:R27 | Q4 | =ASUMIFS(M4#,G4:I33,J4:K33) |
T4:U27 | T4 | =ASUMIFS(ACOMBINE(ADATE(A4:E33,"q",),{1,2,3}),ASELECT(ADATE(A4:E33,"q",),,,,3,),J4:K33) |
W4 | W4 | =FORMULATEXT(Z6) |
W6:X27 | W6 | =ACOMBINE(ADATE(A4:E33,"m",),{1,3}) |
Z6:AA27 | Z6 | =ASUMIFS(ACOMBINE(ADATE(A4:E33,"m",),{1,3}),ASELECT(ADATE(A4:E33,"m",),,,,,{1,3}),J4:K33) |
Q29 | Q29 | =FORMULATEXT(Q31) |
Q31:Q54 | Q31 | =SUMIFS(J4:J33,G4:G33,M4:M27,H4:H33,N4:N27,I4:I33,O4:O27) |
R31:R54 | R31 | =SUMIFS(K4:K33,G4:G33,M4:M27,H4:H33,N4:N27,I4:I33,O4:O27) |
F36,K36 | F36 | =FORMULATEXT(G37) |
G37:I48 | G37 | =ACOMBINE(A37:E51,{1,2,3}) |
L37:M48 | L37 | =ASUMIFS(ACOMBINE(A37:C51,),A37:C51,D37:E51) |
Dynamic array formulas. |
Upvote
0