I have 3 sheets K1,K2,K3:
SHEET1
A 10
B 10
C 10
SHEET2
A 5
B 1
C 2
RESULT :
A 15
B 11
C 12
I compute sum of A, B, C in SHEET3 using
=SUMPRODUCT(SUMIF(INDIRECT("'"&$K$1:$K$2&"'!A1:A3"), "A", INDIRECT("'"&$K$1:$K$2&"'!B1:B3")))
=SUMPRODUCT(SUMIF(INDIRECT("'"&$K$1:$K$2&"'!A1:A3"), "B", INDIRECT("'"&$K$1:$K$2&"'!B1:B3")))
=SUMPRODUCT(SUMIF(INDIRECT("'"&$K$1:$K$2&"'!A1:A3"), "C", INDIRECT("'"&$K$1:$K$2&"'!B1:B3")))
But it gives me an error: #REF!
, any help?
There are a couple of issues here.
I'm not sure you need to use INDIRECT at all. The way I understand your question, your sheet names are K1, and K2. Not that your sheet names are located in cells K1 and K2. So you should be able to reference those names directly.
The other issue is that you can't use 3D references (referencing multiple sheets in one address) with the SUMIF
formula.
Alternatively, you'll need to do the following
=SUMIF(K1!A1:A3,"A",K1!B1:B3)+SUMIF(K1!A1:A3,"B",K1!B1:B3)+SUMIF(K1!A1:A3,"C",K1!B1:B3)