APIVOT

=APIVOT(a,rw,cl,vl,vf)

a
array
rw
integer, column index that holds corespondent PT row values
cl
integer, column index that holds corespondent PT column values
vl
integer, integer, column index that holds corespondent PT values
vf
integer, value field, 0 or ignored for sum, 1 for count, 2 for min, 3 for max

array pivot, reproduces basic functionality of Pivot Table, with a single cell lambda, for any array, regular, dynamic, table, no refresh needed

Xlambda

Well-known Member
Joined
Mar 8, 2021
Messages
832
Office Version
  1. 365
Platform
  1. Windows
APIVOT array pivot, reproduces basic functionality of Pivot Table, with a single cell lambda, for any array, regular, dynamic, table. calls AAGGREGATE , APPEND2V , APPEND2H
Basic functionality means: as in PT interface we can select rows values, column values, values, value fields, only sum, count, min and max
- disadvantages: was not designed to compete with mighty PT, does not have grouping functionality as PT does, though, could be added but the formulas can get discouraging huge.
- advantages: no table format needed, no refresh needed, so if we filter a large table for some complex criteria in a simple dynamic array, this lambda can be handy.
Other functions on minisheet ASELECT
Note: Sample data, courtesy of Mike Girvin ExcelIsFun
Excel Formula:
=LAMBDA(a,rw,cl,vl,vf,
    LET(g,"Grand Total",fn,IF(vf=0,0,vf),q,SEQUENCE(,COLUMNS(a)),c,INDEX(a,,cl),r,INDEX(a,,rw),v,INDEX(a,,vl),uc,SORT(UNIQUE(c)),ur,SORT(UNIQUE(r)),tc,TRANSPOSE(uc),f,IF(AND(ISNUMBER(v)),fn,1),
       ar,SWITCH(f,0,SUMIFS(v,r,ur,c,tc),2,MINIFS(v,r,ur,c,tc),3,MAXIFS(v,r,ur,c,tc),1,COUNTIFS(r,ur,c,tc)),fg,SWITCH(f,2,0,3,1,4,7,5),
       rc,AAGGREGATE(ar,fg,),br,TRANSPOSE(AAGGREGATE(TRANSPOSE(ar),fg,)),
       w,ROWS(ar)+1,u,COLUMNS(ar)+2,sr,SEQUENCE(w),sc,SEQUENCE(,u)-1,lc,IF(sr=w,g,INDEX(ur,sr)),tr,SWITCH(sc,0,"("&rw&"\"&cl&")"&" "&vl&" vf="&fn,u-1,g,INDEX(tc,sc)),
       aa,APPEND2V(APPEND2H(ar,rc,),br,),ab,IF(aa="",SWITCH(f,2,MIN(br,rc),3,MAX(br,rc),SUM(rc)),aa),ac,APPEND2V(tr,APPEND2H(lc,ab,),),
       IFS(ISNA(XMATCH(fn,{0,1,2,3})),"check function nr.",NOT(AND(ISNUMBER(XMATCH(CHOOSE({1,2,3},rw,cl,vl),q)))),"check selection",TRUE,ac)
    )
)
LAMBDA 7.0.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAA
1sample data, courtesy of Mike GirvinExcelIsFun=APIVOT(Rev,2,4,6,)vf=0sumSum of Net RevenueColumn Labels
2DateSales RepUnitsProductRegionNet Revenue(2\4) 6 vf=0Crested BeautMajestic BeautQuadSunsetYanakiGrand TotalRow LabelsCrested BeautMajestic BeautQuadSunsetYanakiGrand Total
301-01-20Tynia Malone500QuadMidWest12560.88Chantel Mims7659.578379.3328169.7129746.5913486.9687442.16Chantel Mims7659.578379.3328169.7129746.61348787442.16
401-01-20Kiki Sho38YanakiMidWest902.79Hien Pham7785.007809.9422079.839952.8819538.6867166.33Hien Pham77857809.9422079.839952.8819538.767166.33
501-01-20Hien Pham500YanakiMidWest8035.63Janis Figueroa161.701104.4218189.425683.153039.7528178.44Janis Figueroa161.71104.4218189.425683.153039.7528178.44
601-01-20Chantel Mims500YanakiWest8035.63Kiki Sho9137.046161.932809.605981.8010598.5734688.94Kiki Sho9137.046161.932809.65981.810598.634688.94
701-01-20Tynia Malone39QuadEast1481.47Tynia Malone948.47339.5038904.912434.6314517.6357145.14Tynia Malone948.47339.538904.912434.6314517.657145.14
801-01-20Kiki Sho48SunsetMidWest934.2Grand Total25691.7823795.12110153.553799.0561181.59274621.01Grand Total25691.7823795.12110153.4753799.161181.6274621.01
901-01-20Hien Pham13QuadCanada580.97
1002-01-20Tynia Malone27YanakiNorthWest641.45=APIVOT(Rev,2,4,6,1)vf=1count
1102-01-20Hien Pham13SunsetMidWest337.35(2\4) 6 vf=1Crested BeautMajestic BeautQuadSunsetYanakiGrand Total
1202-01-20Chantel Mims36SunsetMidWest732.87Chantel Mims7567631
1302-01-20Tynia Malone44QuadSouth1596.61Hien Pham2456724
1403-01-20Hien Pham100Crested BeautMidWest1816.5Janis Figueroa1242110
1503-01-20Chantel Mims7YanakiMexico188.65Kiki Sho5234519
1603-01-20Hien Pham5YanakiMexico139.75Tynia Malone1177319
1703-01-20Chantel Mims37QuadMexico1374.05Grand Total1614252622103
1803-01-20Janis Figueroa525QuadMexico13188.92
1903-01-20Chantel Mims450SunsetNorthWest6714.56=APIVOT(Rev,2,4,6,2)vf=2minMin of Net RevenueColumn Labels
2004-01-20Hien Pham45SunsetCanada916.09(2\4) 6 vf=2Crested BeautMajestic BeautQuadSunsetYanakiGrand TotalRow LabelsCrested BeautMajestic BeautQuadSunsetYanakiGrand Total
2104-01-20Tynia Malone3SunsetWest74.85Chantel Mims215.6209.7312.83639.6726.9526.95Chantel Mims215.6209.7312.83639.6726.9526.95
2204-01-20Chantel Mims48Crested BeautWest934.2Hien Pham1816.533.95218.4524.9555.924.95Hien Pham1816.533.95218.4524.9555.924.95
2304-01-20Chantel Mims100Crested BeautMidWest1746.5Janis Figueroa161.734.9585.38174.653039.7534.95Janis Figueroa161.734.9585.38174.653039.7534.95
2404-01-20Hien Pham2YanakiSouth55.9Kiki Sho249.5305.55305.83311.457.957.9Kiki Sho249.5305.55305.83311.457.957.9
2504-01-20Kiki Sho25QuadMexico907.16Tynia Malone948.47339.5298.8374.85641.4574.85Tynia Malone948.47339.5298.8374.85641.4574.85
2604-01-20Chantel Mims8Crested BeautSouth215.6Grand Total161.733.9585.3824.9526.9524.95Grand Total161.733.9585.3824.9526.9524.95
2704-01-20Kiki Sho34Crested BeautMidWest778.86
2804-01-20Chantel Mims275YanakiWest4419.59=APIVOT(Rev,2,4,6,3)vf=3max
2905-01-20Chantel Mims200QuadEast5976.6(2\4) 6 vf=3Crested BeautMajestic BeautQuadSunsetYanakiGrand Total
3005-01-20Hien Pham600YanakiEast9297.75Chantel Mims2724.756291.2514114.387531.788035.6314114.38
3105-01-20Janis Figueroa36Majestic BeautMidWest1069.47Hien Pham5968.56291.2513816.967574.199297.7513816.96
3205-01-20Chantel Mims28QuadMidWest1039.82Janis Figueroa161.71069.4713188.925508.53039.7513188.92
3305-01-20Kiki Sho525YanakiMidWest8437.41Kiki Sho5021.195856.381596.614191.258437.418437.41
3405-01-20Chantel Mims6Majestic BeautCanada209.7Tynia Malone948.47339.512560.88934.27633.8412560.88
3505-01-20Kiki Sho9Majestic BeautWest305.55Grand Total5968.56291.2514114.387574.199297.7514114.38
3605-01-20Hien Pham550QuadMidWest13816.96
3706-01-20Kiki Sho250SunsetEast4191.25=APIVOT(Rev,2,4,3,)Sum of Units2Column Labels
3806-01-20Tynia Malone7QuadCanada298.83(2\4) 3 vf=0Crested BeautMajestic BeautQuadSunsetYanakiGrand TotalRow LabelsCrested BeautMajestic BeautQuadSunsetYanakiGrand Total
3906-01-20Chantel Mims150Crested BeautCanada2724.75Chantel Mims401321102220058174566Chantel Mims401321102220058174566
4006-01-20Tynia Malone43Crested BeautMidWest948.47Hien Pham50029885666011893503Hien Pham50029885666011893503
4107-01-20Kiki Sho21SunsetNorthWest544.95Janis Figueroa6376774071501277Janis Figueroa6376774071501277
4207-01-20Hien Pham13QuadWest554.97Kiki Sho560309763316141890Kiki Sho560309763316141890
4307-01-20Tynia Malone24SunsetWest529.38Tynia Malone431014711118772512Tynia Malone431014711118772512
4407-01-20Tynia Malone15SunsetMexico389.25Grand Total151097541023514364713748Grand Total151097541023514364713748
4508-01-20Kiki Sho2YanakiMidWest57.9
4608-01-20Tynia Malone4SunsetNorthWest99.8=APIVOT(Rev,4,5,3,)Sum of UnitsColumn Labels
4708-01-20Kiki Sho42YanakiEast997.82(4\5) 3 vf=0CanadaEastMexicoMidWestNorthWestSouthWestGrand TotalRow LabelsCanadaEastMexicoMidWestNorthWestSouthWestGrand Total
4808-01-20Chantel Mims500SunsetEast7460.63Crested Beaut1501694112830408891510Crested Beaut150169411283408891510
4908-01-20Hien Pham38Majestic BeautEast1161.19Majestic Beaut15381033657259260975Majestic Beaut15381033657259260975
5008-01-20Tynia Malone48SunsetMexico934.2Quad170241638107827512554454102Quad170241638107827512554454102
5108-01-20Chantel Mims29SunsetSouth639.67Sunset55802664497482299853514Sunset55802664497482299853514
5209-01-20Hien Pham45YanakiCanada1069.09Yanaki458242110655393777763647Yanaki458242110655393777763647
5309-01-20Tynia Malone10SunsetCanada239.5Grand Total43520741744325913532328255513748Grand Total43520741744325913532328255513748
5409-01-20Kiki Sho7QuadWest305.83
5509-01-20Janis Figueroa6Crested BeautMidWest161.7=APIVOT(Rev,4,5,6,)Sum of Net RevenueColumn Labels
5609-01-20Chantel Mims1YanakiWest26.95(4\5) 6 vf=0CanadaEastMexicoMidWestNorthWestSouthWestGrand TotalRow LabelsCanadaEastMexicoMidWestNorthWestSouthWestGrand Total
5709-01-20Tynia Malone475YanakiNorthWest7633.84Crested Beaut2724.753153.696338.655452.0306184.11838.5625691.78Crested Beaut2724.753153.696338.655452.036184.11838.5625691.78
5809-01-20Chantel Mims33Crested BeautMexico699.85Majestic Beaut524.251161.19339.56925.851598.786614.86630.7523795.12Majestic Beaut524.251161.19339.56925.851598.786614.86630.7523795.12
5909-01-20Janis Figueroa75QuadCanada2457.56Quad5794.927543.4517379.5727417.666908.4833327.4711781.9110153.47Quad5794.927543.4517379.627417.666908.4833327.511781.9110153.47
6009-01-20Chantel Mims50Majestic BeautNorthWest1348.13Sunset1155.5912777.589997.947512.927533.96639.6714181.453799.05Sunset1155.5912777.69997.947512.927533.96639.6714181.453799.05
6110-01-20Janis Figueroa7SunsetNorthWest174.65Yanaki1069.0914095.56579.9517433.739222.856298.2412482.261181.59Yanaki1069.0914095.6579.9517433.739222.856298.2412482.261181.59
6210-01-20Chantel Mims575QuadSouth14114.38Grand Total11268.638731.4734635.6164742.1925264.0753064.2846914.8274621.01Grand Total11268.638731.534635.664742.1925264.0753064.346914.8274621.01
6310-01-20Janis Figueroa150YanakiEast3039.75
6411-01-20Kiki Sho300Majestic BeautMidWest5856.38
6511-01-20Janis Figueroa400SunsetMidWest5508.5dynamic APIVOT interface usingASELECT(proves that APIVOT works with dynamic arrays,no need of tables, no refresh)
6611-01-20Chantel Mims32YanakiEast760.24date 1date 2row startrow end
6711-01-20Chantel Mims28Crested BeautMexico617.6103-01-2005-01-201227
6811-01-20Kiki Sho41Crested BeautWest904.36=APIVOT(H70#,1,2,3,)
6911-01-20Chantel Mims425SunsetWest5852.78=ASELECT(Rev,J67,K67,,,{2,4,6})(1\2) 3 vf=0Crested BeautQuadSunsetYanakiGrand Total
7012-01-20Chantel Mims6Majestic BeautNorthWest215.7Hien PhamCrested Beaut1816.5Chantel Mims2896.37350.656714.564608.2421569.75
7112-01-20Hien Pham1Majestic BeautWest33.95Chantel MimsYanaki188.65Hien Pham1816.50916.09195.652928.24
7212-01-20Chantel Mims40SunsetEast814.3Hien PhamYanaki139.75Janis Figueroa013188.920013188.92
7312-01-20Hien Pham28YanakiNorthWest689.01Chantel MimsQuad1374.05Kiki Sho778.86907.16001686.02
7412-01-20Chantel Mims34Crested BeautEast721.06Janis FigueroaQuad13188.92Tynia Malone0074.85074.85
7512-01-20Hien Pham550SunsetMexico7574.19Chantel MimsSunset6714.56Grand Total5491.6621446.737705.54803.8939447.78
7613-01-20Chantel Mims7QuadMexico312.83Hien PhamSunset916.09
7713-01-20Hien Pham9YanakiMexico251.55Tynia MaloneSunset74.85
7813-01-20Kiki Sho10Crested BeautEast249.5Chantel MimsCrested Beaut934.2top left corner cell format
7913-01-20Chantel Mims250Majestic BeautSouth6291.25Chantel MimsCrested Beaut1746.5(rows\columns) values value field=
8013-01-20Hien Pham9Majestic BeautSouth323.55Hien PhamYanaki55.9kept it in this shape because if we pivot regular arrays, they do not have headers
8113-01-20Tynia Malone375YanakiSouth6242.34Kiki ShoQuad907.16
8214-01-20Tynia Malone425QuadSouth10921.12Chantel MimsCrested Beaut215.6
8314-01-20Hien Pham275QuadNorthWest6908.48Kiki ShoCrested Beaut778.86
8414-01-20Kiki Sho44QuadMexico1596.61Chantel MimsYanaki4419.59
8514-01-20Janis Figueroa1Majestic BeautNorthWest34.95Chantel MimsQuad5976.6
8614-01-20Kiki Sho125Crested BeautEast2183.13
APIVOT post
Cell Formulas
RangeFormula
H1,H69,L68,H55,H46,H37,H28,H19,H10H1=FORMULATEXT(H2)
H2:N8H2=APIVOT(Rev,2,4,6,)
H11:N17H11=APIVOT(Rev,2,4,6,1)
H20:N26H20=APIVOT(Rev,2,4,6,2)
H29:N35H29=APIVOT(Rev,2,4,6,3)
H38:N44H38=APIVOT(Rev,2,4,3,)
H47:P53H47=APIVOT(Rev,4,5,3,)
H56:P62H56=APIVOT(Rev,4,5,6,)
J67J67=XMATCH(H67,Rev[Date],1)
K67K67=XMATCH(I67,Rev[Date],-1)
L69:Q75L69=APIVOT(H70#,1,2,3,)
H70:J85H70=ASELECT(Rev,J67,K67,,,{2,4,6})
Dynamic array formulas.
 
Upvote 0
Output.xlsx
ABCDEFGHIJKLMNOPQR
1P&L ItemYearValueName=LET(a,VSTACK([S1.xlsx]A!$A$20#,[S2.xlsx]A!$A$21#,[S3.xlsx]A!$A$20#),FILTER(a,ISNUMBER(INDEX(a,,2))))
2SALES 20227665499.64P&L_Store1.xlsxSALES 20227665499.64Store 1
3SALES 20216877877.23P&L_Store1.xlsxSALES 20216877877.23Store 1Using APIVOT to check PQ's results and ours. Will check not the sums but the averages
4SALES 20207915191.08P&L_Store1.xlsxSALES 20207915191.08Store 1
5SALES 20196390653.09P&L_Store1.xlsxSALES 20196390653.09Store 1=APIVOT(Table_Clean_up_P_L[Year],Table_Clean_up_P_L[Name],Table_Clean_up_P_L[Value],LAMBDA(x,AVERAGE(x)))
6SALES 20186180665.04P&L_Store1.xlsxSALES 20186180665.04Store 1PTP&L_Store1.xlsxP&L_Store2.xlsxP&L_Store3.xlsxGT
7SALES 20176522702.84P&L_Store1.xlsxSALES 20176522702.84Store 1200698375.6798375.67
8SALES 20167407254.81P&L_Store1.xlsxSALES 20167407254.81Store 12007128632.428128632.428
9SALES 20157881384.08P&L_Store1.xlsxSALES 20157881384.08Store 12008138135.61373866.31444107692.2611
10SALES 20147900683.67P&L_Store1.xlsxSALES 20147900683.67Store 12009338168.92386334.451212251.687
11SALES 20137623621.69P&L_Store1.xlsxSALES 20137623621.69Store 12010368156.7959078.9222288482.37175796.6172
12SALES 20127474840.01P&L_Store1.xlsxSALES 20127474840.01Store 12011517213.445164295.912240583.817307364.3913
13SALES 20116046665.4P&L_Store1.xlsxSALES 20116046665.4Store 12012526039.295223736.02279919.428343231.581
14SALES 20104797450.5P&L_Store1.xlsxSALES 20104797450.5Store 12013568315.928282451.934239269.935363345.9323
15SALES 20094238988.64P&L_Store1.xlsxSALES 20094238988.64Store 12014601034.076267849.929188468.49352450.8317
16SALES 20082569998.94P&L_Store1.xlsxSALES 20082569998.94Store 12015575157.518204633.659147317.753309036.31
17SALES 20072107365.63P&L_Store1.xlsxSALES 20072107365.63Store 12016557595.347175940.192150056.825294530.788
18SALES 20061780543.73P&L_Store1.xlsxSALES 20061780543.73Store 12017478038.663190468.926114964.91261157.4997
19LESS: COST OF SALES 2022-4727358.71P&L_Store1.xlsxLESS: COST OF SALES 2022-4727358.71Store 12018439402.582177560.821145965.875254309.7593
20LESS: COST OF SALES 2021-4351331.3P&L_Store1.xlsxLESS: COST OF SALES 2021-4351331.3Store 12019586646.8063241606.225285194.0363371149.0225
21LESS: COST OF SALES 2020-5184178.21P&L_Store1.xlsxLESS: COST OF SALES 2020-5184178.21Store 12020676173.9855220138.6845373994.3655423435.6785
22LESS: COST OF SALES 2019-4163713.07P&L_Store1.xlsxLESS: COST OF SALES 2019-4163713.07Store 12021493091.2682147973.4955197285.3173279450.027
23LESS: COST OF SALES 2018-4075940.66P&L_Store1.xlsxLESS: COST OF SALES 2018-4075940.66Store 12022610066.7555110931.0636173373.1645298123.6612
24LESS: COST OF SALES 2017-4372549.45P&L_Store1.xlsxLESS: COST OF SALES 2017-4372549.45Store 1GT455941.8451189256.9978186341.1265289032.6497
25LESS: COST OF SALES 2016-5086478.49P&L_Store1.xlsxLESS: COST OF SALES 2016-5086478.49Store 1
26LESS: COST OF SALES 2015-5435427.23P&L_Store1.xlsxLESS: COST OF SALES 2015-5435427.23Store 1=APIVOT(G2:G451,I2:I451,H2:H451,LAMBDA(x,AVERAGE(x)))
27LESS: COST OF SALES 2014-5512907.95P&L_Store1.xlsxLESS: COST OF SALES 2014-5512907.95Store 1PTStore 1Store 2Store 3GT
28LESS: COST OF SALES 2013-5389529.74P&L_Store1.xlsxLESS: COST OF SALES 2013-5389529.74Store 1200698375.6798375.67
29LESS: COST OF SALES 2012-5366470.63P&L_Store1.xlsxLESS: COST OF SALES 2012-5366470.63Store 12007128632.428128632.428
30LESS: COST OF SALES 2011-4104185.74P&L_Store1.xlsxLESS: COST OF SALES 2011-4104185.74Store 12008138135.61373866.31444107692.2611
31LESS: COST OF SALES 2010-3289682.02P&L_Store1.xlsxLESS: COST OF SALES 2010-3289682.02Store 12009338168.92386334.451212251.687
32LESS: COST OF SALES 2009-2923228.32P&L_Store1.xlsxLESS: COST OF SALES 2009-2923228.32Store 12010368156.7959078.9222288482.37175796.6172
33LESS: COST OF SALES 2008-1858275.51P&L_Store1.xlsxLESS: COST OF SALES 2008-1858275.51Store 12011517213.445164295.912240583.817307364.3913
34LESS: COST OF SALES 2007-1487724.66P&L_Store1.xlsxLESS: COST OF SALES 2007-1487724.66Store 12012526039.295223736.02279919.428343231.581
35LESS: COST OF SALES 2006-1302388.62P&L_Store1.xlsxLESS: COST OF SALES 2006-1302388.62Store 12013568315.928282451.934239269.935363345.9323
36GROSS PROFIT 20222938140.93P&L_Store1.xlsxGROSS PROFIT 20222938140.93Store 12014601034.076267849.929188468.49352450.8317
37GROSS PROFIT 20212526545.93P&L_Store1.xlsxGROSS PROFIT 20212526545.93Store 12015575157.518204633.659147317.753309036.31
38GROSS PROFIT 20202731012.87P&L_Store1.xlsxGROSS PROFIT 20202731012.87Store 12016557595.347175940.192150056.825294530.788
39GROSS PROFIT 20192226940.02P&L_Store1.xlsxGROSS PROFIT 20192226940.02Store 12017478038.663190468.926114964.91261157.4997
40GROSS PROFIT 20182104724.38P&L_Store1.xlsxGROSS PROFIT 20182104724.38Store 12018439402.582177560.821145965.875254309.7593
41GROSS PROFIT 20172150153.39P&L_Store1.xlsxGROSS PROFIT 20172150153.39Store 12019586646.8063241606.225285194.0363371149.0225
42GROSS PROFIT 20162320776.32P&L_Store1.xlsxGROSS PROFIT 20162320776.32Store 12020676173.9855220138.6845373994.3655423435.6785
43GROSS PROFIT 20152445956.85P&L_Store1.xlsxGROSS PROFIT 20152445956.85Store 12021493091.2682147973.4955197285.3173279450.027
44GROSS PROFIT 20142387775.72P&L_Store1.xlsxGROSS PROFIT 20142387775.72Store 12022610066.7555110931.0636173373.1645298123.6612
45GROSS PROFIT 20132234091.95P&L_Store1.xlsxGROSS PROFIT 20132234091.95Store 1GT455941.8451189256.9978186341.1265289032.6497
46GROSS PROFIT 20122108369.38P&L_Store1.xlsxGROSS PROFIT 20122108369.38Store 1
47GROSS PROFIT 20111942479.66P&L_Store1.xlsxGROSS PROFIT 20111942479.66Store 1
48GROSS PROFIT 20101507768.48P&L_Store1.xlsxGROSS PROFIT 20101507768.48Store 1=AND(L7:O24=L28:O45)
49GROSS PROFIT 20091315760.32P&L_Store1.xlsxGROSS PROFIT 20091315760.32Store 1TRUE
50GROSS PROFIT 2008711723.43P&L_Store1.xlsxGROSS PROFIT 2008711723.43Store 1
Clean up P&L
Cell Formulas
RangeFormula
F1,L48,K26,K5F1=FORMULATEXT(F2)
F2:I451F2=LET(a,VSTACK([S1.xlsx]A!$A$20#,[S2.xlsx]A!$A$21#,[S3.xlsx]A!$A$20#),FILTER(a,ISNUMBER(INDEX(a,,2))))
K6:O24K6=APIVOT(Table_Clean_up_P_L[Year],Table_Clean_up_P_L[Name],Table_Clean_up_P_L[Value],LAMBDA(x,AVERAGE(x)))
K27:O45K27=APIVOT(G2:G451,I2:I451,H2:H451,LAMBDA(x,AVERAGE(x)))
L49L49=AND(L7:O24=L28:O45)
Dynamic array formulas.
 
Some cool ideas inspired by latest YT from Chandoo
(has link to download the source workbook "monthly-workbook.xlsx")
Introducing a useful lambda: REF3D(vs,[hd]) a function that can deal with 3D references/ranges
vs
: the vstack formula that can take 3D references
hd: headers argument; if 0 or omitted, no headers; if 1, we have headers
Excel Formula:
=LAMBDA(vs, [hd],
    LET(
        l, LAMBDA(x, AND(x = 0)),
        a, BYROW(vs, l),
        b, BYCOL(vs, l),
        f, FILTER(FILTER(vs, NOT(a)), NOT(b)),
        IF(hd, LET(h, TAKE(f, 1), g, BYROW(N(f = h), l), VSTACK(h, FILTER(f, g))), f)
    )
)
If source workbook is open, we add an empty spreadsheet at the end called "End" then we can call this lambda on any other workbook to create the stacked array:
=REF3D(VSTACK('[monthly-workbook.xlsx]Jan:End'!$A$1:$G$1000),1)
- as 3D reference we used larger array vertically and horizontally. The function is designed to crop the blanks in both directions.
- any spreadsheet added on source workbook before "End", updates automatically, no refresh needed
REF3D.xlsx
ABCDEFGHI
1Sales PersonCountryProductDateAmountBoxes
2Ches BonnellAustraliaChoco Coated Almonds4492812971721
3Roddy SpeechleyUK70% Dark Bites44928161068rows check
4Rafaelita BlakslandNew Zealand70% Dark Bites4492851818=ROWS(A1#)-1
5Roddy SpeechleyNew ZealandMint Chip Choco449281393452751
6Wilone O'KieltNew ZealandRaspberry Choco44928106451
7Ches BonnellUSAPeanut Butter Cubes449291988111
8Oby SorrelIndiaChoco Coated Almonds449292457145
9Camilla CastleAustraliaMint Chip Choco4492911158360
10Marney O'BreenUKFruit & Nut Bars449292961198
11Mallorie WaberUKSpicy Special Slims449293738340
12Beverie MoffetUKSmooth Sliky Salty449291421285
13Curtice AdvaniUSAAlmond Choco44929161756
14Jehu RudeforthUSAOrganic Choco Syrup449293976362
15Barr FaughnyIndiaAfter Nines44929282
16Oby SorrelUK85% Dark Bars449298785489
17Husein AugarAustraliaSmooth Sliky Salty44929180813014
18Gunar ****shootUSAMilk Bars449292422143
19Oby SorrelIndia50% Dark Bites449292618437
20Dotty StrutleyNew ZealandEclairs44929235974
21Gigi BohlingCanada99% Dark & Pure44929238085
22Karlen McCaffreyIndiaMilk Bars449296391427
23Wilone O'KieltAustralia70% Dark Bites449293668127
24Brien BoiseNew Zealand99% Dark & Pure4492913391536
25Karlen McCaffreyUSAChoco Coated Almonds4492912691977
26Brien BoiseIndiaAlmond Choco4492929411
27Karlen McCaffreyUK85% Dark Bars449306069380
28Rafaelita BlakslandAustralia50% Dark Bites449302450273
29Van TuxwellUSAFruit & Nut Bars449302002182
30Brien BoiseNew ZealandOrange Choco449301330103
31Ches BonnellUSAAlmond Choco4493011179466
32Andria KimptonUSABaker's Choco Chips449302877170
33Oby SorrelUSAOrange Choco449306510434
34Rafaelita BlakslandIndia85% Dark Bars449301925121
35Wilone O'KieltUK70% Dark Bites449306874265
36Brien BoiseUSASpicy Special Slims449306965465
37Wilone O'KieltNew ZealandFruit & Nut Bars449303780420
38Gigi BohlingNew ZealandSmooth Sliky Salty449307322611
39Beverie MoffetCanadaChoco Coated Almonds449307168359
40Barr FaughnyUKCaramel Stuffed Bars44931211497
41Husein AugarUKSmooth Sliky Salty44931111441592
42Mallorie WaberCanada85% Dark Bars449313857184
43Gigi BohlingUSAMilk Bars449316545385
44Karlen McCaffreyUKAfter Nines4493172832
45Jan MorforthNew Zealand70% Dark Bites449323857143
46Mallorie WaberUKAlmond Choco449325425217
47Oby SorrelCanadaAfter Nines449326776283
48Barr FaughnyUSAOrganic Choco Syrup449322961198
49Karlen McCaffreyIndiaSmooth Sliky Salty449322317331
50Marney O'BreenNew ZealandAfter Nines4493213286493
51Roddy SpeechleyNew ZealandBaker's Choco Chips449328393525
52Roddy SpeechleyIndiaRaspberry Choco449326587236
53Madelene UpcottAustraliaAlmond Choco449321476
54Gigi BohlingUSA99% Dark & Pure4493213391536
55Kelci WalkdenUSAAlmond Choco449322184100
56Oby SorrelUKAfter Nines449326951366
57Gunar ****shootIndia99% Dark & Pure449323927152
58Camilla CastleAustralia50% Dark Bites449355159737
59Marney O'BreenNew ZealandManuka Honey Choco449358456423
60Barr FaughnyNew ZealandManuka Honey Choco4493513454612
61Oby SorrelUKOrange Choco449357287405
62Mallorie WaberIndiaMint Chip Choco449356069243
63Van TuxwellIndiaWhite Choc449353878243
64Madelene UpcottNew ZealandBaker's Choco Chips449357812558
65Wilone O'KieltCanadaRaspberry Choco4493530815
66Wilone O'KieltCanadaManuka Honey Choco449366342289
67Madelene UpcottIndiaOrange Choco449363003301
68Gunar ****shootNew ZealandDrinking Coco4493692437
69Van TuxwellNew Zealand70% Dark Bites44936234579
70Marney O'BreenIndiaPeanut Butter Cubes449365565232
71Ches BonnellUSAWhite Choc4493642028
72Gigi BohlingUSARaspberry Choco449366888265
73Gunar ****shootAustraliaManuka Honey Choco449367147286
74Kelci WalkdenIndiaMint Chip Choco4493611424369
75Gunar ****shootAustraliaRaspberry Choco449362457112
76Dennison CrosswaiteNew ZealandChoco Coated Almonds449365698475
77Dennison CrosswaiteIndiaOrange Choco449366216415
78Gunar ****shootUKAlmond Choco44936272391
79Dotty StrutleyNew ZealandSmooth Sliky Salty449367532754
80Dotty StrutleyIndiaAfter Nines449368729437
81Van TuxwellCanada85% Dark Bars4493616968808
82Curtice AdvaniNew ZealandRaspberry Choco449367679334
83Camilla CastleUSA85% Dark Bars449367091473
84Jehu RudeforthNew Zealand50% Dark Bites449361897146
85Curtice AdvaniNew ZealandSpicy Special Slims449367924721
86Marney O'BreenCanadaMint Chip Choco4493610241366
87Gigi BohlingAustraliaAfter Nines449363045133
88Oby SorrelUSAOrganic Choco Syrup44936136921141
89Gunar ****shootIndiaAfter Nines449366405292
90Oby SorrelIndiaSmooth Sliky Salty449364389732
91Camilla CastleNew ZealandSmooth Sliky Salty4493647640
92Gunar ****shootUKChoco Coated Almonds4493616812
93Madelene UpcottCanadaMint Chip Choco4493615204585
94Gunar ****shootUKMint Chip Choco449364781184
95Husein AugarAustraliaRaspberry Choco44937242990
96Madelene UpcottUKManuka Honey Choco449376223260
97Camilla CastleNew ZealandDrinking Coco4493716037802
98Rafaelita BlakslandUSAOrange Choco449376587388
99Husein AugarNew ZealandMint Chip Choco449374697168
100Husein AugarIndiaAlmond Choco449379457430
Sheet1
Cell Formulas
RangeFormula
A1:F2752A1=REF3D(VSTACK('[monthly-workbook.xlsx]Jan:End'!$A$1:$G$1000),1)
H4H4=FORMULATEXT(H5)
H5H5=ROWS(A1#)-1
Dynamic array formulas.


Calling some APIVOT is a breeze, everything fully dynamic, no refresh needed, we can add more spreadsheets before "End" one, ready in 2s

REF3D.xlsx
IJKLMNOPQRSTUVWXYZAA
1
2Product1-Jan2-Feb3-Mar4-Apr5-May6-JunGTS.PersonAustraliaCanadaIndiaNew ZealandUKUSAAmount
350% Dark Bites851139480878680101234158480149807668122Andria Kimpton1323149649511906310525910592491861650916
470% Dark Bites108941108192126147101304170128139881754593Barr Faughny1009611127001138971161028963593786627081
585% Dark Bars146993884667846313472989663147707686021Beverie Moffet1039011128129998811038314036463721631169
699% Dark & Pure1265397923377154143395156422111321694064Brien Boise86058134946950251333019095198294638575
7After Nines172970767489276459206136353137599675640Camilla Castle12194797349102018924569284185729592340
8Almond Choco847981144291049586977613287463329570164Ches Bonnell87283934367084071197104825124264551845
9Baker's Choco Chips671727959016841362160198149156996732480Curtice Advani101920108675977901193577752573381578648
10Caramel Stuffed Bars6825011221013448493737132601150759692041Dennison Crosswaite657091021658404911751694227158165621831
11Choco Coated Almonds9779011550061516107877150451120736653870Dotty Strutley9759410353011032710828313695579821636510
12Drinking Coco10706510836096369148176102095147952710017Gigi Bohling858061012556740310278178197106869542311
13Eclairs10063210107312190584623178255138061724549Gunar ****shoot922888554011517811218984924125748615867
14Fruit & Nut Bars1052591032365973113355311144097447610666Husein Augar102186124152977831042659678997566622741
15Manuka Honey Choco1287799487854327165564187509113358744415Jan Morforth121079789958133310269713241294640611156
16Milk Bars864368828498119141610151459110019675927Jehu Rudeforth102585793731228011072269128098623601888
17Mint Chip Choco14465510082811766310169614060975614681065Kaine Padly572881298711122527823910619797069580916
18Orange Choco88368869758711561187120456165018609119Karlen McCaffrey14109911699112024610122776797103089659449
19Organic Choco Syrup1016681088298723498805233051114303743890Kelci Walkden9639710217912261211336511888197013650447
20Peanut Butter Cubes803748617799666139937112917117138636209Madelene Upcott69706116956956209867211216891056584178
21Raspberry Choco14732214856110636576160114695172732765835Mallorie Waber80598109039105770720169489271141533456
22Smooth Sliky Salty1252091092149359762643166348126700683711Marney O'Breen1109929882610790512314411319781564635628
23Spicy Special Slims11356112620356147107457126308164150693826Oby Sorrel1385931268471021308708010784997685660184
24White Choc5338212287812111492022148190205170742756Rafaelita Blaksland742701233898096212298396803106974605381
25GT23412762254672212193122868513218453292579715148980Roddy Speechley128058101843104398968459702088249616413
26Van Tuxwell12569277630469981191967572694381539623
27Wilone O'Kielt106001697558547010162695970101605560427
28GT25303252604749246185826174052512349242229415148980
29
30
31S.PersonAmountS.PersonBoxes
32Andria Kimpton650916Andria Kimpton38833
33Barr Faughny627081Barr Faughny35853
34Beverie Moffet631169Beverie Moffet38247
35Brien Boise638575Brien Boise38329
36Camilla Castle592340Camilla Castle35891
37Ches Bonnell551845Ches Bonnell34906
38Curtice Advani578648Curtice Advani38074
39Dennison Crosswaite621831Dennison Crosswaite38168
40Dotty Strutley636510Dotty Strutley39785
41Gigi Bohling542311Gigi Bohling33003
42Gunar ****shoot615867Gunar ****shoot37195
43Husein Augar622741Husein Augar38806
44Jan Morforth611156Jan Morforth37778
45Jehu Rudeforth601888Jehu Rudeforth35355
46Kaine Padly580916Kaine Padly34290
47Karlen McCaffrey659449Karlen McCaffrey41216
48Kelci Walkden650447Kelci Walkden38757
49Madelene Upcott584178Madelene Upcott35852
50Mallorie Waber533456Mallorie Waber31962
51Marney O'Breen635628Marney O'Breen38352
52Oby Sorrel660184Oby Sorrel43683
53Rafaelita Blaksland605381Rafaelita Blaksland34216
54Roddy Speechley616413Roddy Speechley39477
55Van Tuxwell539623Van Tuxwell33846
56Wilone O'Kielt560427Wilone O'Kielt31582
57GT15148980GT923456
58
Sheet1
Cell Formulas
RangeFormula
J2:Q25J2=LET(a,DROP(A1#,1),APIVOT(INDEX(a,,3),TEXT(INDEX(a,,4),"m-mmm"),INDEX(a,,5),LAMBDA(x,SUM(x)),"Product"))
S2:Z28S2=LET(a,DROP(A1#,1),APIVOT(INDEX(a,,1),TEXT(INDEX(a,,2),"m-mmm"),INDEX(a,,5),LAMBDA(x,SUM(x)),"S.Person","Amount"))
J31:K57J31=LET(a,DROP(A1#,1),APIVOT(INDEX(a,,1),,INDEX(a,,5),LAMBDA(x,SUM(x)),"S.Person","Amount"))
S31:T57S31=LET(a,DROP(A1#,1),APIVOT(INDEX(a,,1),,INDEX(a,,6),LAMBDA(x,SUM(x)),"S.Person","Boxes"))
Dynamic array formulas.
 
A function that a had fun before, it's what I like to call an interactive function on multiple levels. We can "print" a full list of options, we can select based on those options, filtered outcome based on selected options
SLICER(ar,cl,[lst],[sl])
ar: array
cl: column index of the slicer
[lst]: list argument: can be omitted or can be a reference of the selected slicers
[sl]: select argument, can be omitted or as text string of indexes separated by comas (like in"1,3,5")
interactive functionality:
- if lst is omitted and sl is omitted will have the full list/array of slicer values and their index.
- if lst is omitted and sl is for example "1,3,5", the function will return only those chosen slicers that correspond with respective indexes
- if lst is not omitted, and refers to the refrence of the array of slicer values, the function will return the main array filtered based on the slicer values
Excel Formula:
=LAMBDA(ar, cl, [lst], [sl],
    LET(
        a, IF(ar = "", "", ar),
        c, INDEX(a, , cl),
        s, SORT(UNIQUE(c)),
        IF(
            ISOMITTED(lst),
            IF(ISOMITTED(sl), HSTACK(SEQUENCE(ROWS(s)), s), INDEX(s, --TEXTSPLIT(sl, , ","))),
            FILTER(a, REDUCE(0, lst, LAMBDA(v, i, v + (c = i))))
        )
    )
)

REF3D.xlsx
ABCDEFGHIJKLMNOPQ
1shorter sample of main big array1st interactive use2nd interactive use
2Sales PersonCountryProductDateAmountBoxeslst,sl,omittedlst,omitted,sl,"1,3,5"
3Ches BonnellAustraliaChoco Coated Almonds4492812971721all slicer valuesbased on visualizing all slicers, we choose what we need
4Roddy SpeechleyUK70% Dark Bites44928161068=SLICER(A3:F71,2)=SLICER(A3:F71,2,,"1,3,5")
5Rafaelita BlakslandNew Zealand70% Dark Bites44928518181AustraliaAustralia
6Roddy SpeechleyNew ZealandMint Chip Choco449281393452CanadaIndia
7Wilone O'KieltNew ZealandRaspberry Choco449281064513IndiaUK
8Ches BonnellUSAPeanut Butter Cubes4492919881114New Zealand
9Oby SorrelIndiaChoco Coated Almonds4492924571455UK
10Camilla CastleAustraliaMint Chip Choco44929111583606USAlst, now is a refrence obtained by other interactive instance of same function
11Marney O'BreenUKFruit & Nut Bars4492929611983rd interactive use, array filtered based on slicer values
12Mallorie WaberUKSpicy Special Slims449293738340=SLICER(A3:F71,2,K5#)
13Beverie MoffetUKSmooth Sliky Salty449291421285Ches BonnellAustraliaChoco Coated Almonds02-01-2312971721
14Curtice AdvaniUSAAlmond Choco44929161756Roddy SpeechleyUK70% Dark Bites02-01-23161068
15Jehu RudeforthUSAOrganic Choco Syrup449293976362Oby SorrelIndiaChoco Coated Almonds03-01-232457145
16Barr FaughnyIndiaAfter Nines44929282Camilla CastleAustraliaMint Chip Choco03-01-2311158360
17Oby SorrelUK85% Dark Bars449298785489Marney O'BreenUKFruit & Nut Bars03-01-232961198
18Husein AugarAustraliaSmooth Sliky Salty44929180813014Mallorie WaberUKSpicy Special Slims03-01-233738340
19Gunar ****shootUSAMilk Bars449292422143Beverie MoffetUKSmooth Sliky Salty03-01-231421285
20Oby SorrelIndia50% Dark Bites449292618437Barr FaughnyIndiaAfter Nines03-01-23282
21Dotty StrutleyNew ZealandEclairs44929235974Oby SorrelUK85% Dark Bars03-01-238785489
22Gigi BohlingCanada99% Dark & Pure44929238085Husein AugarAustraliaSmooth Sliky Salty03-01-23180813014
23Karlen McCaffreyIndiaMilk Bars449296391427Oby SorrelIndia50% Dark Bites03-01-232618437
24Wilone O'KieltAustralia70% Dark Bites449293668127Karlen McCaffreyIndiaMilk Bars03-01-236391427
25Brien BoiseNew Zealand99% Dark & Pure4492913391536Wilone O'KieltAustralia70% Dark Bites03-01-233668127
26Karlen McCaffreyUSAChoco Coated Almonds4492912691977Brien BoiseIndiaAlmond Choco03-01-2329411
27Brien BoiseIndiaAlmond Choco4492929411Karlen McCaffreyUK85% Dark Bars04-01-236069380
28Karlen McCaffreyUK85% Dark Bars449306069380Rafaelita BlakslandAustralia50% Dark Bites04-01-232450273
29Rafaelita BlakslandAustralia50% Dark Bites449302450273Rafaelita BlakslandIndia85% Dark Bars04-01-231925121
30Van TuxwellUSAFruit & Nut Bars449302002182Wilone O'KieltUK70% Dark Bites04-01-236874265
31Brien BoiseNew ZealandOrange Choco449301330103Barr FaughnyUKCaramel Stuffed Bars05-01-23211497
32Ches BonnellUSAAlmond Choco4493011179466Husein AugarUKSmooth Sliky Salty05-01-23111441592
33Andria KimptonUSABaker's Choco Chips449302877170Karlen McCaffreyUKAfter Nines05-01-2372832
34Oby SorrelUSAOrange Choco449306510434Mallorie WaberUKAlmond Choco06-01-235425217
35Rafaelita BlakslandIndia85% Dark Bars449301925121Karlen McCaffreyIndiaSmooth Sliky Salty06-01-232317331
36Wilone O'KieltUK70% Dark Bites449306874265Roddy SpeechleyIndiaRaspberry Choco06-01-236587236
37Brien BoiseUSASpicy Special Slims449306965465Madelene UpcottAustraliaAlmond Choco06-01-231476
38Wilone O'KieltNew ZealandFruit & Nut Bars449303780420Oby SorrelUKAfter Nines06-01-236951366
39Gigi BohlingNew ZealandSmooth Sliky Salty449307322611Gunar ****shootIndia99% Dark & Pure06-01-233927152
40Beverie MoffetCanadaChoco Coated Almonds449307168359Camilla CastleAustralia50% Dark Bites09-01-235159737
41Barr FaughnyUKCaramel Stuffed Bars44931211497Oby SorrelUKOrange Choco09-01-237287405
42Husein AugarUKSmooth Sliky Salty44931111441592Mallorie WaberIndiaMint Chip Choco09-01-236069243
43Mallorie WaberCanada85% Dark Bars449313857184Van TuxwellIndiaWhite Choc09-01-233878243
44Gigi BohlingUSAMilk Bars449316545385Madelene UpcottIndiaOrange Choco10-01-233003301
45Karlen McCaffreyUKAfter Nines4493172832Marney O'BreenIndiaPeanut Butter Cubes10-01-235565232
46Jan MorforthNew Zealand70% Dark Bites449323857143
47Mallorie WaberUKAlmond Choco449325425217
48Oby SorrelCanadaAfter Nines449326776283
49Barr FaughnyUSAOrganic Choco Syrup449322961198
50Karlen McCaffreyIndiaSmooth Sliky Salty449322317331
51Marney O'BreenNew ZealandAfter Nines4493213286493
52Roddy SpeechleyNew ZealandBaker's Choco Chips449328393525
53Roddy SpeechleyIndiaRaspberry Choco449326587236
54Madelene UpcottAustraliaAlmond Choco449321476
55Gigi BohlingUSA99% Dark & Pure4493213391536
56Kelci WalkdenUSAAlmond Choco449322184100
57Oby SorrelUKAfter Nines449326951366
58Gunar ****shootIndia99% Dark & Pure449323927152
59Camilla CastleAustralia50% Dark Bites449355159737
60Marney O'BreenNew ZealandManuka Honey Choco449358456423
61Barr FaughnyNew ZealandManuka Honey Choco4493513454612
62Oby SorrelUKOrange Choco449357287405
63Mallorie WaberIndiaMint Chip Choco449356069243
64Van TuxwellIndiaWhite Choc449353878243
65Madelene UpcottNew ZealandBaker's Choco Chips449357812558
66Wilone O'KieltCanadaRaspberry Choco4493530815
67Wilone O'KieltCanadaManuka Honey Choco449366342289
68Madelene UpcottIndiaOrange Choco449363003301
69Gunar ****shootNew ZealandDrinking Coco4493692437
70Van TuxwellNew Zealand70% Dark Bites44936234579
71Marney O'BreenIndiaPeanut Butter Cubes449365565232
72
Sheet2
Cell Formulas
RangeFormula
H4,K12,K4H4=FORMULATEXT(H5)
H5:I10H5=SLICER(A3:F71,2)
K5:K7K5=SLICER(A3:F71,2,,"1,3,5")
K13:P45K13=SLICER(A3:F71,2,K5#)
Dynamic array formulas.


Using SLICER with APIVOT on the big data set, full dynamic and interactive.
One interactive use of SLICER , for selecting certain values out of all possibilities. We keep it as refrence for visualizing purposes.
Other interactive use of SLICER inside APIVOT as filtered by selection array

REF3D.xlsx
ABCDEFGHIJKLMN
1
2=SLICER(DROP(Sheet1!A1#,1),2,,"1,3,5")
3↓↓=LET(a,SLICER(DROP(Sheet1!A1#,1),2,B5#),APIVOT(INDEX(a,,1),INDEX(a,,2),INDEX(a,,5),LAMBDA(x,SUM(x)),"S.Person","Amount"))
4↓↓↓↓
5AustraliaS.PersonAustraliaIndiaUKAmount
6IndiaAndria Kimpton132314119063105924357301
7UKBarr Faughny10096111389789635304493
8Beverie Moffet10390199988140364344253
9Brien Boise860589502590951272034
10Camilla Castle12194710201892841316806
11Ches Bonnell8728370840104825262948
12Curtice Advani1019209779077525277235
13Dennison Crosswaite657098404994227243985
14Dotty Strutley97594110327136955344876
15Gigi Bohling858066740378197231406
16Gunar ****shoot9228811517884924292390
17Husein Augar1021869778396789296758
18Jan Morforth12107981333132412334824
19Jehu Rudeforth10258512280191280316666
20Kaine Padly57288112252106197275737
21Karlen McCaffrey14109912024676797338142
22Kelci Walkden96397122612118881337890
23Madelene Upcott6970695620112168277494
24Mallorie Waber8059810577094892281260
25Marney O'Breen110992107905113197332094
26Oby Sorrel138593102130107849348572
27Rafaelita Blaksland742708096296803252035
28Roddy Speechley12805810439897020329476
29Van Tuxwell1256924699875726248416
30Wilone O'Kielt1060018547095970287441
31GT2530325246185825123497504532
32
Sheet3
Cell Formulas
RangeFormula
B2B2=FORMULATEXT(B5)
D3D3=FORMULATEXT(D5)
B5:B7B5=SLICER(DROP(Sheet1!A1#,1),2,,"1,3,5")
D5:H31D5=LET(a,SLICER(DROP(Sheet1!A1#,1),2,B5#),APIVOT(INDEX(a,,1),INDEX(a,,2),INDEX(a,,5),LAMBDA(x,SUM(x)),"S.Person","Amount"))
Dynamic array formulas.
 
Another quick one, cool latest video of @MrExcel, 1h ago
APIVOT can take array calculations (virtual/helper columns that are not even there)
Data sample as is the downloadable workbook
Excel_Calculate_Average_Repair_Costs_By_Age_Of_Vehicle_Episode_2627.xlsx
ABCDEFG
1VehicleService DateService DescriptionCosts
2V-00102-11-2004JQBZ AZB132.75
3V-00107-22-2004JQBZ AZB0.00rows of data
4V-00101-03-2005BJAQ JABB QJQJJ QA BAJQQABQAQ129.28=ROWS(A1:D4468)-1
5V-00101-31-2005JQBZ AZB273.094467
6V-00101-31-2005BJAQ JABB QJQJJ AJ BAQQAQZ BABJA135.45
7V-00105-12-2005BJAQ JABB QJQJJ QQAQQAQ JABJAB AJ211.41
8V-00106-15-2005BJAQ JABB QJQJJ QA/AJ QAQAQ/BJAZAQ JAQAQ1,173.53
9V-00108-18-2005JQBZ AZB378.34
10V-00102-24-2006JQBZ AZB40.17
11T-00407-24-2006AJABQQABAJ0.00
12V-00108-09-2006JQBZ AZB311.65
13T-00408-31-2006AJAB JABQ QAAJ JABBQ AQQZ BQAJAJ ABB604.89
14V-00110-18-2006QAQAQ BJAQ217.56
15T-00510-19-2006JQAZAJQAQAZA JAAJQAJAJBA [2000-2199]369.72
16T-00510-19-2006AQAAJ QAQAAQA QAJJZ JABQ BAQAQ164.84
17V-00102-05-2007QAQA QBQAA BAZA QJAZ JAAJ/JAAQAJB AAQ215.38
18V-00102-12-2007BA/QAQJ JAJJAJB AJB QABAQ QAABB1,068.60
19V-00103-07-2007JQBZ AZB280.18
20T-00503-29-2007J/B BAAB JAQBB AJAJAQAQAZA86.32
21T-00404-11-2007JQAZAJQAQAZA JAAJQAJAJBA281.25
22T-00504-26-2007JQAZAJQAQAZA JAAJQAJAJBA353.01
23V-00105-21-2007BBQBQZQ BABJAQ & QAQJAJAJQ BAQQABAB171.52
24V-00107-19-2007QAQA QAJJABA QJAQA391.84
25T-00409-28-2007JJ AJQJABQAAJ [A,B JJ]284.76
26V-00110-04-2007JQBZ AZB [ABB JJ]805.93
27V-00110-04-2007AZBAAQQ BAJQ97.85
28T-00510-10-2007JJ AJQJABQAAJ [A,B,B JJ]711.41
29T-00410-19-2007JABBQ QAQJ QABJAJ JAQ ZAQJAJB201.57
30T-00601-22-2008JJ AJQJABQAAJ [A JJ] 2JB QAJA199.20
31T-01303-07-2008JJ AJQJABQAAJ [A JJ]344.37
32T-01203-19-2008JJ AJQJABQAAJ [A JJ]187.05
33T-00403-19-2008JJ AJQJABQAAJ [A.B. JJ]351.93
Data
Cell Formulas
RangeFormula
F4F4=FORMULATEXT(F5)
F5F5=ROWS(A1:D4468)-1
Named Ranges
NameRefers ToCells
_FilterDatabase=Data!$A$1:$D$1F5
DATA4=Data!$C$2:$C$4468F5
DATA5=Data!$D$2:$D$4468F5
TEST1=Data!$A$3335:$D$4468F5
TESTHKEY=Data!$C$1:$D$1F5


Single cell formula for SUMs
Excel Formula:
=LET(v,A2:A4468,d,B2:B4468,s,DATA5,APIVOT(v,DATEDIF(MAP(v,LAMBDA(x,MIN(IF(x=v,d))))-90,d,"Y")+1,s,LAMBDA(x,SUM(x))))
Excel_Calculate_Average_Repair_Costs_By_Age_Of_Vehicle_Episode_2627.xlsx
HIJKLMNOPQRSTUVWXYZAAABACADAE
1
2PT1234567891011121314151617181920GT
3T-004886.14838.26684.041565.77383.91004.0158.31243.745253.58537.71163.12130.481999.112682.041249.46963.462675.832814.4526133.39
4T-005973.89976.531035.991036.541433.34627.27467.61013914.13472.24238.67797.82816.371640.243328.881065.791008.63017846.93
5T-0061114.081028.45635.77267.11463.87311497.11322.83454.721378.75154.31491.461007.581020.81482.95121.369752.16
6T-0101420.651154.96486.791466.533560.093829.211196.41882.442845.631712.061738.47648.51374.64730.91746.275300.2630093.81
7T-011430.621060.15808.132965.141059.394007.741150.751625.151488.05378.06705.455642.375841.473774.722481.14701.8934120.22
8T-0121082.09939.6884.883595.55961.72989.41496.011541.741385.241341.272585.54773.342051.288796.895449.14857.2233730.92
9T-0131738.51061.682111.142775.43873.5568.351040.472929.391349.061332.491259.082243.051650.244624.792802.425326.9736686.53
10T-0171275.931292.941520.961727.932828.223091.754314.834980.773342.293359.812052.258043.292025.7949856.75
11T-018549.641193.82623.65432.222042.291212.15579.871056.821535.97589.92368.13984.561938.62700013807.66
12T-0201461.861463.541530.82442.921191.067057.9710677.642547.158375.464349.297270.198903.0510409.998541.42032.4478254.76
13T-022732.961456.031292.131837.212097.91139.1819691.192061.837675.989711.492923.633283.8210685.132527.754072.5671188.79
14T-024685.811555.461364.423042.081880.561221.822053.621727.892838.712106.581399.545732.491175.36443.923237.9130466.17
15T-0262096.011822.753423.793877.064081.11402.055397.744037.483189.138408.635343.322786.853325.1116702213.6565106.68
16T-029812.391178.511237.09290.77763.951561.73905.45658.25535.9983.98781.863142.113464.79727.0417043.82
17T-035463.635331.02100.02493.88365.711047.22987.57631.271660.92855.29250.25636.29832.72937.1416592.91
18T-037625.342979.17763.88194.03981.821721.47950.162410.321978.266868.946806.513258.662681.5732220.13
19T-0441238.89922.68949.67902.391657.899388.915581.269362.632766.793452.412890.2439113.76
20T-045549.364142.51628.354081.641003.212893.651751.792120.225934.163663.973088.86132.7329990.45
21T-0491219.331123.83051.974128.411495.336223.696492.24332.897754.755594.8412713.9954131.2
22T-050279.612802.461013.745361.31683.2910115.6114699.064691.116729.888436.624378.615.5160196.8
23T-0510427.412158.141863.028614.723219.769707.212876.845052.487396.23454.5241770.33
24T-052389.032696.912889.225660.584135.934244.956574.779856.032469.2538916.67
25T-0561733.6534.961237.4651.972730.751888.222457.284815.49016049.67
26T-0581627.88283.73449.38688.451008.184615.43735.209408.25
27T-060925.02614.43824.141268.987804.862093.631072.1529.0914632.3
28T-061159.59341470.28377.84452.51636.72273.572711.51
29T-063262.614635.861995.534716.726438.84930.0815333.1638312.76
30T-069404.311224.011423.871493.642539.227085.05
31T-070494.31697.691088.881138.01632.054050.94
32T-071603.69810.241443.421013.481196.175067
33V-001132.752301.1569.383031.3601.323593.24702.525072374.2907.012090.393975.97917.7836.191383.11734.11640.832912.573966.543652.8435830.07
34V-008662.8927.361488.24984.742582.662812.073116.291600.264079.773108.811577.532736.72795.212555.141077.292207.7232312.61
35V-0091625.23972.09597.31950.362590.157292.67355.011020.391670.48829.25577.621248.89761.34937.372106.48965.0224499.66
36V-019685.7208.920337.6194.462170.122249.05382.421503.123500.232946.4376.022523.591246.644106.122330.38
37V-023704.163088.07421.21624.552583.032388.321461.0590.032646.721843.6212771.219113.172201.347649.741287.5848873.8
38V-028443.131141.242779.05215.8712144.543398.831210.22487.863947.8688.721625.58806.651905.7130795.2
39V-032626.161671.26850.071359.64202.442105.37454.98377.731673.131659.281982.811752.123079.061437.0719231.12
40V-034580.35631.93313.7709.35344.26777.57804.86683.231024.912784.17323.64868.51792.931775.7612415.17
41V-036509.912221.721206.162657.544828.165233.265166.68985.036627.265584.814913.49176.2648110.2
42V-039613.51928.52910.361698.913789.731941.522324.119004.271288.131339.251865.663177.55370.834252.27
43V-040838.97589.171376.011822.34747.623783.65383.91624.616024.246030.064036.256792.861263.8834313.57
44V-0421141.641463.931574.772293.513779.45636.81343.713131.56949.141355.5466.5123136.47
45V-0433357.232560.941789.224557.032784.725906.4887.115064.616486.664334.41047728.32
46V-0461660.371160.652929.232150.322728.754057.878159.531344.751275.471978.151779.629224.69
47V-047682.728691433.95603.93946.653727.072480.17738.018383.021181.06393.2621438.84
48V-048813.211041.941158466.81927.83790.61892.362822.54539.2798.31174.2616425.01
49V-053324.49360.381534.921817.931404.424125.733910.6815349.433216.893163.7135208.58
50V-054628.172108.762212.41238.821920.112636.343803.241976.923697.552881.2923103.6
51V-055797.54768.093639.93983.162099.792255.535588.362274.994044.276489.428941.06
52V-057131.69257.155112.19891.151376.051059.622553.7520381.51
53V-059337.53899.71741.37528.08903.841872.585686.810969.91
54V-062653.344895.494395.991953.7212017.2813197.962445.95039559.73
55V-064218.031152.81304.551120.614665.592034.794142.5414638.91
56V-065829.51848.17738.913311.93199.083257.382459.1414644.09
57V-066384.993186.372621.252435.083059.813157.43663.7918508.69
58V-0671486.03581.031715.86511.475597.59891.89
59V-072401.05398.58842.491298.46165.83106.38
60GT47506.8992824.9382383.99101910.75148446.33169255.68181388.1124219.96150982.3123387.59107090.7578661.0570891.3172287.5537057.3818243.84325.295727.023966.543652.841624210.05
61
Data
Cell Formulas
RangeFormula
I2:AD60I2=LET(v,A2:A4468,d,B2:B4468,s,DATA5,APIVOT(v,DATEDIF(MAP(v,LAMBDA(x,MIN(IF(x=v,d))))-90,d,"Y")+1,s,LAMBDA(x,SUM(x))))
Dynamic array formulas.
Named Ranges
NameRefers ToCells
DATA5=Data!$D$2:$D$4468I2
TEST1=Data!$A$3335:$D$4468I2


or for AVERAGEs
Excel Formula:
=LET(v,A2:A4468,d,B2:B4468,s,DATA5,APIVOT(v,DATEDIF(MAP(v,LAMBDA(x,MIN(IF(x=v,d))))-90,d,"Y")+1,s,LAMBDA(x,AVERAGE(x))))
Excel_Calculate_Average_Repair_Costs_By_Age_Of_Vehicle_Episode_2627.xlsx
HIJKLMNOPQRSTUVWXYZAAABACADAE
1
2PT1234567891011121314151617181920GT
3T-004295.38279.42136.808313.15476.78251.002558.3177.677141313.395134.425145.3965.24333.185536.408249.892321.153382.261562.89318.699878
4T-005243.4725488.265147.9986345.51333286.668156.8175233.8126.625152.355118.06119.335132.97272.1233410.06832.22266.448252.1580241.17473
5T-006278.52257.1125211.9233133.555115.9675103.66667165.7033107.61113.68344.687577.155122.865335.86204.162160.983360.68184.003019
6T-010202.95192.4933121.6975293.306593.34833319.10083170.9157176.488316.1811214.0075347.694162.125458.2133182.725249.46711060.05310.245464
7T-011215.31176.6917161.626370.6425211.878364.34164.3929325.03212.578642.006667141.09470.1975730.1838629.12413.5233701.89331.264272
8T-012180.3483156.6147.48719.11137.38857197.88270.85857256.95667197.8914191.61287.28222128.89227.92977.4322389.2243171.444295.885263
9T-013217.3125212.336234.5711462.56667484.1875142.0875148.6386418.48429168.6325111.04083179.86857320.4357275.04660.6843254.7655887.828310.902797
10T-017159.4913215.49190.12191.99222235.685257.64583308.2021415.06417477.47373.31111927.09615670.2742337.6317389.505859
11T-018274.82170.5457103.9417144.07333255.28625173.1642982.83857352.27333307.194196.64184.065196.912323.10331750200.111014
12T-020292.372365.885191.35244.292119.106705.797762.6886363.87857837.546543.66125727.0191112.881867.49922847.133406.488631.086774
13T-022244.32145.603258.426229.65125190.71818162.741312.746257.72875548.2843809.29083265.78455410.4775971.3755210.6458581.7943501.329507
14T-024137.162194.4325194.9171338.00889268.65143174.54571256.7025143.99083218.3623351.09667279.9081433.123391.7867110.98359.7678284.730561
15T-026161.2315202.5278263.3685352.46510.1387567.008333674.7175448.60889318.9131401.4383593.70222278.685415.63882087.7571.21667496.997557
16T-029101.5488130.9456137.454496.92333376.395111.55214129.3582.28125107.18163.99667156.372314.211494.97103.8629157.813148
17T-035231.8151777.00750.01123.4773.142209.444141.0814157.8175237.2743171.058125.125159.0725166.54734.285281.235763
18T-03789.33429229.1669190.9748.5075140.26430.3675135.7371301.29282.6086763.21556680.651250.6662893.8567335.626354
19T-044154.8613131.8114237.4175128.91286276.315938.891465.105936.263345.8488383.60111361.28439.480449
20T-045109.872591.787178.54375680.27333111.46778321.51667194.6433265.0275659.3511523.42429441.2657144.24333344.717816
21T-049203.2217160.5429435.9957458.71222149.533414.91267721.3556361.07417861.6389329.10824977.99923474.835088
22T-05055.922215.5738126.7175487.39091168.329778.123851130.697469.111672.9881054.5775729.768332.755552.26422
23T-051071.235269.7675266.14571861.472643.9521386.744287.684631.56924.52875113.63564.463919
24T-05255.57571168.5569361.1525377.372375.99364424.495730.53758.15615274.3611397.108878
25T-056433.4106.992176.7714162.9925341.34375314.70333307.16481.5490302.823962
26T-058203.48556.746112.345229.48333201.6361153.8575147.040261.340278
27T-060132.1457122.886117.7343158.6225780.486299.09153.164329.09281.390385
28T-06131.91848.71429156.76188.9290.502127.34491.1990.3836667
29T-06343.76833331.1329285.0757524.08643.88448.189091916.645589.427077
30T-069101.0775111.2736142.387186.705634.805191.487838
31T-07082.385116.2817155.5543189.66833210.68333144.676429
32T-07186.24143162.048240.57168.91333199.36167168.9
33V-00166.375383.5167189.7933433.04286200.44399.24889234.1733169593.55302.33667298.62714662.6617183.54209.0475345.7775183.528213.61485.428793.308730.568389.457283
34V-008110.4667185.472372.06140.67714368.95143351.50875259.6908177.80667679.9617282.61909262.92167547.344198.8025425.8567153.8986275.965291.104595
35V-009325.046243.0225149.3275237.59259.015729.267177.505127.54875238.64118.4642996.27249.778190.335234.3425351.08321.673275.277079
36V-019171.425208.920168.80594.46434.024249.8944382.42300.624700.046589.28125.34504.718207.7733821.22385.006552
37V-023140.832441.1529105.3025156.1375258.303341.18857162.338945.015661.68460.905912.229291012.574314.4771695.4309214.5967474.502913
38V-02888.626163.0343347.3813107.9351734.9343679.766172.8886243.93789.56229.57333406.395201.6625952.855504.839344
39V-032104.36334.252141.6783151.0711150.61191.39727227.49125.91418.2825237.04283.25857292.02307.906159.6744216.08
40V-034193.45210.6433104.5667177.337586.065259.19160.972170.8075128.1138696.0425161.82173.702158.586443.94217.81
41V-03650.991277.715134.0178265.754402.34667523.326430.55691.15615828.4075507.71614.1862558.75333422.019298
42V-039122.702132.6457227.59212.36375473.71625323.58667290.5138900.427184.0186223.20833266.52286288.8636895.1333368.303978
43V-040139.8283196.39114.6675260.33429106.80286315.30417191.955156.1525502.02402.004672.70833617.5327421.2933343.1357
44V-042190.2733133.0845174.9744191.12583472.425469.73333167.9638782.89237.285271.1155.50333282.152073
45V-043335.723256.094162.6564350.54077309.41333738.3177.422562.733331268.205481.601110487.023673
46V-046207.5463128.9611266.2936215.032389.82143507.23375815.953168.09375212.5783282.59286355.92328.367303
47V-047136.544124.1429119.4958150.9825189.33621.17833413.3617184.50252095.755295.265196.63363.370169
48V-048203.3025115.7711193233.4240.97875131.76833223.091411.25567.4159.66587.13293.30375
49V-053108.163390.095139.5382259.70429280.884317.36385488.8351180.7254402.1113527.285451.392051
50V-054157.0425263.595368.7333176.97429240.01375376.62422.5822219.65778616.2583360.16125320.883333
51V-055132.9233153.618363.993163.86349.965205.04818698.545252.77667404.427589.94545352.939756
52V-05726.321322.45852.0317148.525275.21151.37429283.75452.922444
53V-05984.3825128.53185.3425264.04150.64208.064442843.4322.644412
54V-06272.59333445.0445313.9993150.28615924.40615879.864407.65830476.623253
55V-06454.5075164.6857260.91124.51222466.559290.68429591.7914298.753265
56V-065138.2517141.3617147.782473.12857290.82545361.93111491.828298.85898
57V-06642.77667398.2963262.125405.84667339.97889394.675366.379308.478167
58V-067212.29116.206343.172102.294621.94444319.093226
59V-07280.2179.716210.6225162.307541.45119.476154
60GT149.3927238.0126215.6649270.32029352.60411401.07981478.5966404.62528493.4062422.56024469.69627418.4098472.6087573.7107359.7804444.971308.949440.54793.308730.568363.601981
61
Data
Cell Formulas
RangeFormula
I2:AD60I2=LET(v,A2:A4468,d,B2:B4468,s,DATA5,APIVOT(v,DATEDIF(MAP(v,LAMBDA(x,MIN(IF(x=v,d))))-90,d,"Y")+1,s,LAMBDA(x,AVERAGE(x))))
Dynamic array formulas.
Named Ranges
NameRefers ToCells
DATA5=Data!$D$2:$D$4468I2
TEST1=Data!$A$3335:$D$4468I2
 
For the ones who still like to use ...IFS functions (I never use them, by default) in this case of simple use, MINIFS works fine
Excel Formula:
=LET(v,A2:A4468,d,B2:B4468,s,DATA5,APIVOT(v,DATEDIF(MINIFS(d,v,v)-90,d,"y")+1,s,LAMBDA(x,SUM(x))))
Copy of Excel_Calculate_Average_Repair_Costs_By_Age_Of_Vehicle_Episode_2627.xlsx
HIJKLMNOPQRSTUVWXYZAAABACADAE
1
2PT1234567891011121314151617181920GT
3T-004886.14838.26684.041565.77383.91004.0158.31243.745253.58537.71163.12130.481999.112682.041249.46963.462675.832814.4526133.39
4T-005973.89976.531035.991036.541433.34627.27467.61013914.13472.24238.67797.82816.371640.243328.881065.791008.63017846.93
5T-0061114.081028.45635.77267.11463.87311497.11322.83454.721378.75154.31491.461007.581020.81482.95121.369752.16
6T-0101420.651154.96486.791466.533560.093829.211196.41882.442845.631712.061738.47648.51374.64730.91746.275300.2630093.81
7T-011430.621060.15808.132965.141059.394007.741150.751625.151488.05378.06705.455642.375841.473774.722481.14701.8934120.22
8T-0121082.09939.6884.883595.55961.72989.41496.011541.741385.241341.272585.54773.342051.288796.895449.14857.2233730.92
9T-0131738.51061.682111.142775.43873.5568.351040.472929.391349.061332.491259.082243.051650.244624.792802.425326.9736686.53
10T-0171275.931292.941520.961727.932828.223091.754314.834980.773342.293359.812052.258043.292025.7949856.75
11T-018549.641193.82623.65432.222042.291212.15579.871056.821535.97589.92368.13984.561938.62700013807.66
12T-0201461.861463.541530.82442.921191.067057.9710677.642547.158375.464349.297270.198903.0510409.998541.42032.4478254.76
13T-022732.961456.031292.131837.212097.91139.1819691.192061.837675.989711.492923.633283.8210685.132527.754072.5671188.79
14T-024685.811555.461364.423042.081880.561221.822053.621727.892838.712106.581399.545732.491175.36443.923237.9130466.17
15T-0262096.011822.753423.793877.064081.11402.055397.744037.483189.138408.635343.322786.853325.1116702213.6565106.68
16T-029812.391178.511237.09290.77763.951561.73905.45658.25535.9983.98781.863142.113464.79727.0417043.82
17T-035463.635331.02100.02493.88365.711047.22987.57631.271660.92855.29250.25636.29832.72937.1416592.91
18T-037625.342979.17763.88194.03981.821721.47950.162410.321978.266868.946806.513258.662681.5732220.13
19T-0441238.89922.68949.67902.391657.899388.915581.269362.632766.793452.412890.2439113.76
20T-045549.364142.51628.354081.641003.212893.651751.792120.225934.163663.973088.86132.7329990.45
21T-0491219.331123.83051.974128.411495.336223.696492.24332.897754.755594.8412713.9954131.2
22T-050279.612802.461013.745361.31683.2910115.6114699.064691.116729.888436.624378.615.5160196.8
23T-0510427.412158.141863.028614.723219.769707.212876.845052.487396.23454.5241770.33
24T-052389.032696.912889.225660.584135.934244.956574.779856.032469.2538916.67
25T-0561733.6534.961237.4651.972730.751888.222457.284815.49016049.67
26T-0581627.88283.73449.38688.451008.184615.43735.209408.25
27T-060925.02614.43824.141268.987804.862093.631072.1529.0914632.3
28T-061159.59341470.28377.84452.51636.72273.572711.51
29T-063262.614635.861995.534716.726438.84930.0815333.1638312.76
30T-069404.311224.011423.871493.642539.227085.05
31T-070494.31697.691088.881138.01632.054050.94
32T-071603.69810.241443.421013.481196.175067
33V-001132.752301.1569.383031.3601.323593.24702.525072374.2907.012090.393975.97917.7836.191383.11734.11640.832912.573966.543652.8435830.07
34V-008662.8927.361488.24984.742582.662812.073116.291600.264079.773108.811577.532736.72795.212555.141077.292207.7232312.61
35V-0091625.23972.09597.31950.362590.157292.67355.011020.391670.48829.25577.621248.89761.34937.372106.48965.0224499.66
36V-019685.7208.920337.6194.462170.122249.05382.421503.123500.232946.4376.022523.591246.644106.122330.38
37V-023704.163088.07421.21624.552583.032388.321461.0590.032646.721843.6212771.219113.172201.347649.741287.5848873.8
38V-028443.131141.242779.05215.8712144.543398.831210.22487.863947.8688.721625.58806.651905.7130795.2
39V-032626.161671.26850.071359.64202.442105.37454.98377.731673.131659.281982.811752.123079.061437.0719231.12
40V-034580.35631.93313.7709.35344.26777.57804.86683.231024.912784.17323.64868.51792.931775.7612415.17
41V-036509.912221.721206.162657.544828.165233.265166.68985.036627.265584.814913.49176.2648110.2
42V-039613.51928.52910.361698.913789.731941.522324.119004.271288.131339.251865.663177.55370.834252.27
43V-040838.97589.171376.011822.34747.623783.65383.91624.616024.246030.064036.256792.861263.8834313.57
44V-0421141.641463.931574.772293.513779.45636.81343.713131.56949.141355.5466.5123136.47
45V-0433357.232560.941789.224557.032784.725906.4887.115064.616486.664334.41047728.32
46V-0461660.371160.652929.232150.322728.754057.878159.531344.751275.471978.151779.629224.69
47V-047682.728691433.95603.93946.653727.072480.17738.018383.021181.06393.2621438.84
48V-048813.211041.941158466.81927.83790.61892.362822.54539.2798.31174.2616425.01
49V-053324.49360.381534.921817.931404.424125.733910.6815349.433216.893163.7135208.58
50V-054628.172108.762212.41238.821920.112636.343803.241976.923697.552881.2923103.6
51V-055797.54768.093639.93983.162099.792255.535588.362274.994044.276489.428941.06
52V-057131.69257.155112.19891.151376.051059.622553.7520381.51
53V-059337.53899.71741.37528.08903.841872.585686.810969.91
54V-062653.344895.494395.991953.7212017.2813197.962445.95039559.73
55V-064218.031152.81304.551120.614665.592034.794142.5414638.91
56V-065829.51848.17738.913311.93199.083257.382459.1414644.09
57V-066384.993186.372621.252435.083059.813157.43663.7918508.69
58V-0671486.03581.031715.86511.475597.59891.89
59V-072401.05398.58842.491298.46165.83106.38
60GT47506.8992824.9382383.99101910.75148446.33169255.68181388.1124219.96150982.3123387.59107090.7578661.0570891.3172287.5537057.3818243.84325.295727.023966.543652.841624210.05
61
Data
Cell Formulas
RangeFormula
I2:AD60I2=LET(v,A2:A4468,d,B2:B4468,s,DATA5,APIVOT(v,DATEDIF(MINIFS(d,v,v)-90,d,"y")+1,s,LAMBDA(x,SUM(x))))
Dynamic array formulas.
Named Ranges
NameRefers ToCells
DATA5=Data!$D$2:$D$4468I2
TEST1=Data!$A$3335:$D$4468I2
 
Finally, after almost 4 years of "advocating" for a function that does pivoting tables I am happy to use Excel native functions instead of my ones. (Hope that a native UNPIVOT will follow)
Check out latest ExcelIsFun Mike's YT
Tricks to replace COUNTIFS using GROUPBY/PIVOTBY
EMT1847-1849.xlsx
ABCDEFGHIJKLMNOPQRSTU
1Mike's spreadsheet from downloadable link
2Extra ColumnPostTime to Assemble Product at Post (Seconds)Goal: Count how many times an Assemby Line Post fell below required <10 second assembly time.
319This is an AND Logical Test: Post has to equal given post AND Seconds <10
429.2** This is an example of where a PivotTable would be harder to create
538.3because our condition uses a comparative operator (we have a hurdle as a condition).
648.3
758.8Hurdle in Seconds:10Alternative
8610
9710.7PostCount=GROUPBY(D3:D590,N(E3:E590<H7),SUM)
10881138
1199.12241
121010.73345
13119.94440
14128.55545
151106642
1628.67717
1739.18848
1848.39945
1958.1101042
20610.4111119
2179.1121239
2288.4Total461
2398.3
241011=PIVOTBY(,D3:D590,N(E3:E590<H7),SUM)
25119.7123456789101112Total
26129.5384145404542174845421939461
2718.3
2829.1
2938.5
3048
3158.2
3268.9
33711.5
1848
Cell Formulas
RangeFormula
J9,H24J9=FORMULATEXT(J10)
J10:K22J10=GROUPBY(D3:D590,N(E3:E590<H7),SUM)
H25:T26H25=PIVOTBY(,D3:D590,N(E3:E590<H7),SUM)
Dynamic array formulas.

EMT1847-1849.xlsx
ABCDEFGHIJKLMNOPQRST
1Pivotby can do GroupbyCOUNTIFS using groupby in an intuitive simple way
2simple count with groupby does not need other column
3=GROUPBY(B4:B24,D4:D24,SUM)=LET(x,B4:B24,GROUPBY(x,x,COUNTA))
4ax10a276a7
5by40b336b5
6ay20c252c5
7ax31d151d4
8dz14Total1015Total21
9dz15
10by78Pivotby can do Groupby,ignoring clm fieldscounting filtered data, only values <50
11bx97classic
12cx86=PIVOTBY(B4:B24,,D4:D24,SUM)=GROUPBY(B4:B24,D4:D24,COUNT,,,,D4:D24<50)
13az57a276a5
14cx40b336b2
15cy32c252c3
16az39d151d3
17bz45Total1015Total13
18ax32
19bx76Horizontal Groupby if we ignore row fieldsalternative
20ay87
21dy45=PIVOTBY(,B4:B24,D4:D24,SUM)=GROUPBY(B4:B24,N(D4:D24<50),SUM)
22dx77abcdTotala5
23cy282763362521511015b2=PIVOTBY(B4:B24,C4:C24,N(D4:D24<50),SUM)
24cy66c3 xyzTotal
25d3a3115
26Total13b0112
27c123
28d0123
29Total45413
30
312 conditions values <50 only for x and y
32
33=GROUPBY(B4:B24,N((D4:D24<50)*(C4:C24<"z")),SUM)
34a4
35b1
36c3
37d1
38Total9
39
Sheet2
Cell Formulas
RangeFormula
F3,L3,L33,O23,L21,F21,L12,F12F3=FORMULATEXT(F4)
F4:G8F4=GROUPBY(B4:B24,D4:D24,SUM)
L4:M8L4=LET(x,B4:B24,GROUPBY(x,x,COUNTA))
F13:G17F13=PIVOTBY(B4:B24,,D4:D24,SUM)
L13:M17L13=GROUPBY(B4:B24,D4:D24,COUNT,,,,D4:D24<50)
F22:J23F22=PIVOTBY(,B4:B24,D4:D24,SUM)
L22:M26L22=GROUPBY(B4:B24,N(D4:D24<50),SUM)
O24:S29O24=PIVOTBY(B4:B24,C4:C24,N(D4:D24<50),SUM)
L34:M38L34=GROUPBY(B4:B24,N((D4:D24<50)*(C4:C24<"z")),SUM)
Dynamic array formulas.
 
Thanks for the shout out, Xlambda!!!!! : ) : )

All your formulas in this post are wonderful, but this is magnificent:

=GROUPBY(D3:D590,N(E3:E590<H7),SUM)

Thanks for that clever formula. Many years ago for my array formula book, I timed methods for converting T and F to 1 and 0. --, +0, *1, /1, N function and so on and double negative was the fastest. I have not timed it with the new engine, but here is an alternative to your alternative:

=GROUPBY(D3:D590,--(E3:E590<H7),SUM)

I added these fabulous formula to the download file.

Thanks, Teammate : )

Go Team!!!!
 

Forum statistics

Threads
1,215,359
Messages
6,124,488
Members
449,165
Latest member
ChipDude83

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