OK. Here is an alternative that is much easier to maintain. Create a Named Range (I called it "Sheets", CTRL-F3 to view/edit), using this formula:
=$L$1:INDEX($L:$L,MATCH("zzz",$L:$L))
as you add additional sheets to the list from L4 downwards, the Named range will not need to be changed again. Then, this array formula in B2, copied across and dnown will deliver the answer:
=SUM(SUMIF(INDIRECT("'"&Sheets&"'!A1:J100"),$A2,OFFSET(INDIRECT("'"&Sheets&"'!A1:J100"),,MMULT(IF(T(OFFSET(INDIRECT("'"&Sheets&"'!A1:J1"),,COLUMN(INDIRECT("A:J"))-COLUMN(INDIRECT("A:A")),,1))=B$1,COLUMN(INDIRECT("A:J"))-COLUMN(INDIRECT("A:A")),0),TRANSPOSE(COLUMN(INDIRECT("A:J"))^0)),,1)))
Array Formulae are a little different from ordinary formulae in that they MUST be confirmed in the FIRST CELL ONLY by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. After that, the array can be dragged down as normal, to cover the desired range.
You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.
Don't type the curly brackets yourself - it won't work...
I have set it to cover columns A to J, down as far as row 100. If you need more, adjust the bits in red in B2, array enter, and copy across & down. Do not use whole column references with INDIRECT, as it will process 1,000,000 rows. Make it reasonable, but not excessive!!
Bookmarks