A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
As far as I can tell, this might be caused by the combination of SUMIFS, INDIRECT, and an array of worksheet names inside SUMPRODUCT. Excel will often evaluate that construction incorrectly during workbook open/save recalculation and cache the result as 0 until a forced recalculation occurs.
Your formula might be working after Calculate Sheet because that command forces Excel to fully resolve the INDIRECT references. During normal recalculation, especially after reopening or saving, Excel sometimes evaluates the SUMIFS array portion before the INDIRECT references are fully resolved, so SUMPRODUCT receives an array of zeros.
Try replacing SUMIFS with SUMPRODUCT in
SUMIFS(
INDIRECT("'"&rngWorksheets&"'!"&H$26),
INDIRECT("'"&rngWorksheets&"'!$L:$L"),$Q$5,
INDIRECT("'"&rngWorksheets&"'!$M:$M"),$B11
)
so it looks like this:
=SUMPRODUCT(
SUMPRODUCT(
(INDIRECT("'"&rngWorksheets&"'!$L:$L")=$Q$5)*
(INDIRECT("'"&rngWorksheets&"'!$M:$M")=$B11)*
INDIRECT("'"&rngWorksheets&"'!"&H$26)
))
If performance becomes slow, avoid full-column references inside INDIRECT. Full-column arrays combined with volatile functions are very calculation-intensive and can trigger unstable recalc behavior. Limiting the ranges might improve reliability:
=SUMPRODUCT(
SUMPRODUCT(
(INDIRECT("'"&rngWorksheets&"'!$L$1:$L$5000")=$Q$5)*
(INDIRECT("'"&rngWorksheets&"'!$M$1:$M$5000")=$B11)*
INDIRECT("'"&rngWorksheets&"'!"&H$26)
))
Another thing worth checking is whether H$26 sometimes resolves to an entire-column reference. If H$26 contains something like $N:$N, Excel can behave unpredictably when that is passed through INDIRECT into SUMIFS.
If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.
hth
Marcin