Excel - SUM/COUNTIF across multiple worksheets

Asked By Brand on 20-Mar-09 04:50 PM
Hello All,

I have a 50 worksheet file that has a summary on each page that I would like
to summarize again on a summary page into broader categories.  The summary
value is a formula in a merged cell and right now I have
=SUM('R5:R10'!AV5:AW11)/COUNTIF('R5:R10'!AV5:AW11,">0").  The problem is when
I add in values it doesn't change the number for me.

Any idea what I am doing wrong?

Any help would be greatly appreciated.



T. Valko replied on 20-Mar-09 05:54 PM
COUNTIF doesn't accept 3d references.

Try one of these



Microsoft Excel MVP
Ashish Mathur replied on 20-Mar-09 10:55 PM

I am trying to adapt your solution to do a SUMIF() based on multiple
conditions across sheets.  I am basically trying to sum column B of the 3
sheets based on 2 conditions - column A should have Z and column B should
have a number greater than 15.  Cell C4 in the formula below holds Z.


This formula sums up the the values on the first sheet only.  Where am I
going wrong?


Ashish Mathur
Microsoft Excel MVP
T. Valko replied on 21-Mar-09 01:12 AM
Unfortunately, SUMPRODUCT doesn't accept 3d references either!

However, we can still use SUMPRODUCT for multiple conditions across multiple
sheets but it becomes fairly complicated and the resulting formula is

Create this defined name

Refers to:

This creates a vertical array of the numbers 4:8 that correspond to the
actual range references. This is used in the OFFSET function.

And the formula:


Note that the sheet sequence *must* be a horizontal array: {1,2,3}. If you
had 50 sheets you wouldn't want to do this: {1,2,3,4,5,6,7,8,9,10,......50}.
You could do this:


Using COLUMN makes it a horizontal array.

This is also made somewhat easier since the sheet names follow a sequential
naming pattern. If they didn't then you'd have to list the sheet names in a
horizontal range of cells and then refer to that range.

Note the use of the T and N functions. Without those functions this wouldn't
work. We use T in the first array because we're testing that range for the
TEXT entry Z held in C4. WE use N in the other arrays because we're testing
those arrays for NUMBERS.


We need to calculate an array of offsets used in the OFFSET function that
equate to:

offset C4 and D4 by 0 rows
................................1 row
................................2 rows
................................3 rows

It would be the same as:


If "it" gets much more complicated than this I would suggest using
intermediate formulas on each sheet and then summing those cells.

Microsoft Excel MVP
Ashish Mathur replied on 21-Mar-09 06:51 AM
Thank you.


Ashish Mathur
Microsoft Excel MVP
T. Valko replied on 21-Mar-09 11:52 AM
You're welcome!

Microsoft Excel MVP
Herbert Seidenberg replied on 21-Mar-09 06:54 PM
Excel 2007 Pivot Table
Sum multiple tabs with criteria.
No code, no formulas.
LoriMille replied on 22-Mar-09 03:50 AM
Instead of COUNTIF('R5:R10'!AV5:AW11,">0") use:


with numeric data you can use other functions that are enabled for
multiple-sheet references. eg Instead of =SUMIF('*'!A1,">0") use: