Forum Discussion
Eng_Noah
Mar 10, 2025Brass Contributor
Alternate to SUMIFS array assistance
Hello, everyone. I apologize for asking yet another SUMIFS question, but I haven't been able to find a thread anywhere (so far) that offers a sample similar to what I'm trying to do. I have a...
- Mar 15, 2025
A few more array options to experiment with:
=MMULT(--(TOROW(Table2[Date]) = Table3[Date]), (XLOOKUP(Table2[Item Code], Table1[Item Code], Table1[Category], "") = Table3[[#Headers],[Blue]:[Red]]) * Table2[Units])
Complete with column headers and row labels:
=LET( criteria, DROP(Table3[#Headers],, 1), category, XLOOKUP(Table2[Item Code], Table1[Item Code], Table1[Category], ""), result, MMULT(--(TOROW(Table2[Date]) = Table3[Date]), (category = criteria) * Table2[Units]), HSTACK(Table3[[#All],[Date]], VSTACK(criteria, result)) )
Alternatively, using SUM-SUMIFS with "thunks" (LAMBDA(x)) and broadcasting:
=LET( grϑup, TRANSPOSE(GROUPBY(Table1[Category], Table1[Item Code], LAMBDA(x, LAMBDA(x)), 0, 0)), bcλst, LAMBDA(b, IF(b, Table3[Date], TAKE(grϑup, -1))), result, MAP(bcλst({0}), bcλst({1}), LAMBDA(c,d, SUM(SUMIFS(Table2[Units], Table2[Date], d, Table2[Item Code], c())))), HSTACK(Table3[[#All],[Date]], VSTACK(TAKE(grϑup, 1), result)) )
There's also a basic SUMIFS example in the attached file (on the Production worksheet), using a helper column for "Category"...
Patrick2788
Mar 11, 2025Silver Contributor
With dynamic arrays, you could use:
=LET(
category, XLOOKUP(Table2[Item Code], Table1[Item Code], Table1[Category], "None"),
PIVOTBY(Table2[Date], category, Table2[Units], SUM, , 0, , 0)
)
Eng_Noah
Mar 11, 2025Brass Contributor
Hey Patrick2788,
Tried this after modifying it to work with my real workbook. I see a few errors in the output.
- Figured out what the first column was. It was just the dates in a different format. Figured it out after writing this.
- The second column, which is the first one with a header name, seems to be displaced by 1 row when compared to the rest.
- The fourth and fifth columns (this one is titled just "0") should be added together in a single column.
- While I see what you were going for with the format, I actually do need a way to do each column separately since I need to do extra columns with different titles using VSTACK. With your method, I'm stuck with using the headers that are automatically done with the code. Is there an alternative?
I'll keep testing it out tomorrow, but thanks for something that does get close to what I'm looking for.
- Patrick2788Mar 13, 2025Silver Contributor
If you're able to share an anonymized sample workbook, I can take a look.
- Eng_NoahMar 17, 2025Brass Contributor
Sure thing! I'm sharing an updated version with the additional information I mentioned. I left comments.
Thank you very much!