Fixing the AverageIf across sheets when VStack hits an empty error

Are you puzzled by the #CALC!

2 min readMicrosoft Excel | Help & Support with your Formula, Macro, and VBA problems | A Reddit Community

The formula isn't wrong, it's the filter logic. The `#CALC!` error isn't coming from `VSTACK` itself, which you've confirmed works fine in isolation. The problem is the condition `targetdata="<>0"`. In Excel's `FILTER` function, that's being read as a literal text string, not an inequality. You're asking it to find cells where the value is the three-character string `"<>0"`, which never matches a numeric zero or any number. The result is an empty array, and `AVERAGE` can't average nothing.

This is a classic gotcha. The correct syntax for excluding zeros is `FILTER(targetdata, targetdata<>0)`, without the quotes around the operator. But we understand why you wrote it that way: the `AverageIf` syntax uses a quoted string like `"<>0"`, and it's natural to carry that pattern over to `FILTER`. The difference is that `AverageIf` is a function built for criteria strings, while `FILTER` uses actual Boolean expressions. It's a small detail that trips up even experienced spreadsheet users, especially when working across sheets where you can't visually step through the logic.

What this means for you in practical terms is that your approach is sound, `VSTACK` combined with `FILTER` and `AVERAGE` is exactly the right modern pattern for cross-sheet averaging. It's more flexible than the old `AverageIf` workarounds, and once you fix the filter condition, it will handle zero-exclusion cleanly. The fact that `VSTACK` works across a range of sheets (`InitPage:EndPage!C9`) is a powerful capability that legacy tools simply don't offer. You're already thinking in the right direction; the formula just needs that one correction.

Our take is straightforward: don't abandon the `LET` + `VSTACK` + `FILTER` approach. It's the future of cross-sheet aggregation. Change `targetdata="<>0"` to `targetdata<>0`, and you'll get your `.167` average. If you want to be extra defensive, wrap it in `IFERROR` to handle edge cases where every sheet has a zero, but for your current data, the fix is that single operator. Your workflow is already ahead of the curve, now make it run.

From Microsoft Excel | Help & Support with your Formula, Macro, and VBA problems | A Reddit Community

Effectively what I'm trying to do is an AverageIf formula across worksheets (which obviously doesn't work). I want to take cell C9 in all sheets between InitPage:EndPage where the value is not 0. In the past I did that similar to the formula I have, which is the following -

=LET(targetdata,VSTACK(InitPage:EndPage!C9),AVERAGE(FILTER(targetdata, targetdata="<>0")))

Read the original at Microsoft Excel | Help & Support with your Formula, Macro, and VBA problems | A Reddit Community