G
Gary Thomson
Yesterday I posted the question:
Is there a quicker way of summing the multiplication of 2
values in each sheet over a number of sheets?
i.e.
=Sheet1!B2*Sheet1!C2+Sheet2!B2*Sheet2!C2+Sheet3!B2*Sheet3!
C2+Sheet4!B2*Sheet4!C2+Sheet5!B2*Sheet5!C2+...+Sheet29!
B2*Sheet29!C2+Sheet30!B2*Sheet30!C2
And i got the answer:
=SUMPRODUCT(N(INDIRECT("Sheet"&{1,2,...,30}&"!B2")),
N(INDIRECT("Sheet"&{1,2,...,30}&"!C2")))
Which works!!!
But suppose I have the following:
Sheet1:
B2: a
C2: £10
Sheet2:
B2: b
C2: £11
Sheet3:
B2:
C2: £15
and so on up to sheet 30.
Now if B2 contains text, this acts as a "1", and if not,
then it acts as a zero. So the formula for the above
would be:
=1*10 + 1*11 + 0*15
=21
At the moment, I currently have this as the following
formula:
=COUNTA(Sheet1!B2)*Sheet1!C2+COUNTA(Sheet2!B2)*Sheet2!
C2+COUNTA(Sheet3!B2)*Sheet3!C2+...+COUNTA(Sheet30!B2)
*Sheet30!C2
How could I make this a SUMPRODUCT, or something else that
is shorter?
Is there a quicker way of summing the multiplication of 2
values in each sheet over a number of sheets?
i.e.
=Sheet1!B2*Sheet1!C2+Sheet2!B2*Sheet2!C2+Sheet3!B2*Sheet3!
C2+Sheet4!B2*Sheet4!C2+Sheet5!B2*Sheet5!C2+...+Sheet29!
B2*Sheet29!C2+Sheet30!B2*Sheet30!C2
And i got the answer:
=SUMPRODUCT(N(INDIRECT("Sheet"&{1,2,...,30}&"!B2")),
N(INDIRECT("Sheet"&{1,2,...,30}&"!C2")))
Which works!!!
But suppose I have the following:
Sheet1:
B2: a
C2: £10
Sheet2:
B2: b
C2: £11
Sheet3:
B2:
C2: £15
and so on up to sheet 30.
Now if B2 contains text, this acts as a "1", and if not,
then it acts as a zero. So the formula for the above
would be:
=1*10 + 1*11 + 0*15
=21
At the moment, I currently have this as the following
formula:
=COUNTA(Sheet1!B2)*Sheet1!C2+COUNTA(Sheet2!B2)*Sheet2!
C2+COUNTA(Sheet3!B2)*Sheet3!C2+...+COUNTA(Sheet30!B2)
*Sheet30!C2
How could I make this a SUMPRODUCT, or something else that
is shorter?