Subtotal LET Dynamic Arrays Without SUMIFS in Excel
Question details
Calculate subtotals for dynamic arrays created inside an Excel LET formula.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A formula uses LET and CHOOSECOLS to create calculated arrays that need to be grouped and subtotaled.
- Observed behavior
- SUMIFS can return an error when calculated arrays are passed as its criteria or sum ranges instead of worksheet range references.
Check that your Excel version supports LET, CHOOSECOLS, UNIQUE, HSTACK, MAP, LAMBDA, and FILTER. Leave enough empty cells below and to the right of the formula for the results to spill.
Use FILTER and SUM to subtotal each unique value
Use this approach when the criteria and value columns exist as calculated arrays inside LET rather than as worksheet ranges.
UNIQUE creates the list of groups, and MAP runs a LAMBDA for each group. FILTER selects the matching values, SUM totals them, and HSTACK places the groups beside their totals.
Select an empty worksheet cell and enter: =LET(_data,{"A",1;"A",1;"A",1;"A",1;"A",1;"B",1;"B",1;"B",1;"B",1;"B",1},_crit_col,CHOOSECOLS(_data,1),_val_col,CHOOSECOLS(_data,2),_criteria,UNIQUE(_crit_col),HSTACK(_criteria,MAP(_criteria,LAMBDA(c,SUM(FILTER(_val_col,_crit_col=c))))))
Press Enter. The formula should spill two columns showing A with a subtotal of 5 and B with a subtotal of 5.
In the formula bar, replace the array constant assigned to _data with your calculated two-column array. If the criteria and numeric values are in different columns, adjust the column numbers in CHOOSECOLS.

Work with spreadsheet subtotals in WPS Office
WPS Office is a free, lightweight Office alternative with a familiar spreadsheet interface and Excel format compatibility for easier migration. It does not fix Excel's SUMIFS range requirement; check function support before using formulas that rely on newer dynamic-array functions.

Frequently Asked Questions
Why does SUMIFS fail with an array created inside LET?
SUMIFS expects range references for its sum and criteria ranges. An array calculated by LET or CHOOSECOLS is not necessarily a worksheet range, so passing it directly can cause an error.
Can I use SUMIFS if the data is in worksheet cells?
Yes. For example, use =SUMIFS(B2:B11,A2:A11,D2) to sum values in B2:B11 where A2:A11 matches the criterion in D2.
What does MAP do in the subtotal formula?
MAP applies the LAMBDA to each value returned by UNIQUE. For each value, FILTER selects matching rows and SUM calculates their subtotal.
Why does the formula show a spill error?
The result needs empty cells for both the group names and subtotals. Clear any occupied cells in the intended spill area and recheck the formula.




