Forum Discussion
SUMIFS with OR Logic and spilling results
- Nov 30, 2021
I tried to combine all in one spill
with
=IFERROR( LET( select, FILTER(B16#, $B$17:$D$17 <> ""), c, COLUMNS(select), fSel, MMULT(--(select = dB[Forecast]), SEQUENCE(c, , 1, 0)) * dB[Incl], uMonths, SORT(UNIQUE(FILTER(dB[Month], fSel))), uRegions, TRANSPOSE(SORT(UNIQUE(FILTER(dB[Region], fSel)))), nRegions, COLUMNS(uRegions), nMonths, ROWS(uMonths), data, MMULT( --(uMonths = TRANSPOSE(dB[Month])), (uRegions = dB[Region]) * dB[Value] ), total, MMULT(data, SEQUENCE(nRegions, , 1, 0)), k, SEQUENCE(nMonths + 1, nRegions + 2), kR, INT((k - 1) / (nRegions + 1 + 1)) + 1, kC, MOD(k - 1, nRegions + 1 + 1) + 1, IF( kR = 1, IF( kC = 1, "R/M", IF(kC = nRegions + 2, "Total", INDEX(uRegions, kC - 1)) ), IF( kC = 1, INDEX(uMonths, kR - 1), IF( kC = nRegions + 2, INDEX(total, kR - 1), INDEX(data, kR - 1, kC - 1) ) ) ) ), "no data" )
=SUMPRODUCT(((dB[Forecast]=Table!$C$2)+(dB[Forecast]=Table!$C$3)+(dB[Forecast]=Table!$C$4))*(dB[Month]=Table!$B25)*(dB[Region]=Table!C$24)*dB[Value])
Is this what you are looking for?
OliverScheurich thanks for your reply. Yes, this works. I have even worked out such formula myself based on SUMIFS in array formula:
={SUM(SUMIFS(dB[Value],dB[Month],$B9,dB[Region],C$8,dB[Forecast],$C$2:$C$4))}
However, instead of using this approach by populating every cell, I was wondering whether there is a way to use the spill functionality. I.e. only type 1 formula and then the whole table is spilled with the results.
- Riny_van_EekelenNov 30, 2021Platinum Contributor
ravanwijk Perhaps like in the attached file. But you'll need to expand the data table to test for either of the three Forecast values (changed one of then just to test). Now the formula spills as desired. Though, I'm wondering why you wouldn't use a pivot table. Included one to demonstrate what I mean.