J
JeffB
The below question was in a previous post (Sumif with multiple criteria
question):
Given range named "type" and "qty", i am trying to write a formula that will
sum the "qty" of multiple "type"s together. I've tried
=sum(if((type="apples")+(type="oranges"),qty,0) and
=sumif(type,(or("apples"),("oranges")),qty)
neither work....can someone help me please?
T. Valko (Biff) posted a great solution to this question:
=SUMPRODUCT(--(ISNUMBER(MATCH(type,items,0))),qty)
I am using Excel 2003 and wondering if this formula can be further enhanced
to add item quantities if the quantities were spread out across multiple
locations in separate columns but only add desired locations (while ignoring
errors)?
Type Qty1 Qty2 Qty3 Qty4 ...
apples 2 1 0 4
oranges 10 8 4 5
bananas 4 6 18 9
I know that it could be simply added (SUMPRODUCT+SUMPRODUCT+….) or use:
=SUMPRODUCT(--(ISNUMBER(MATCH(type,items,0))),((qty1)+(qty2))
But I need something better and one that will ignore #N/A errors since I am
using INDEX and MATCH functions to find the appropriate columns which may or
may not be present on data sheets given to me on a monthly basis. Here is
the formula that I am using, but if the data is not present for one or more
of my “qty†columns, it returns an error value.
=SUMPRODUCT(--(ISNUMBER(MATCH(INDIRECT("'"&$A4&"'!$B$5:$B$1000"),IHLCC,0)))*((INDEX(INDIRECT("'"&$A4&"'!$A$5:$Z$1000"),0,MATCH(C$2,INDIRECT("'"&$A4&"'!$A$3:$Z$3"),0)))+(INDEX(INDIRECT("'"&$A4&"'!$A$5:$Z$1000"),0,MATCH(D$2,INDIRECT("'"&$A4&"'!$A$3:$Z$3"),0)))+(INDEX(INDIRECT("'"&$A4&"'!$A$5:$Z$1000"),0,MATCH(L$2,INDIRECT("'"&$A4&"'!$A$3:$Z$3"),0)))))
If I use =IF(ISERROR(…) for each “qtyâ€, the formula is too long for my
version of Excel 2003
Column A ("'"&$A4&"'!)= contains monthly data sheet names which makes it
easier to fill the table
IHLCC = “items’ named range
C2, D2, L2 = ‘qty†lookup values
Thank you for your help!
Jeff
question):
Given range named "type" and "qty", i am trying to write a formula that will
sum the "qty" of multiple "type"s together. I've tried
=sum(if((type="apples")+(type="oranges"),qty,0) and
=sumif(type,(or("apples"),("oranges")),qty)
neither work....can someone help me please?
T. Valko (Biff) posted a great solution to this question:
=SUMPRODUCT(--(ISNUMBER(MATCH(type,items,0))),qty)
I am using Excel 2003 and wondering if this formula can be further enhanced
to add item quantities if the quantities were spread out across multiple
locations in separate columns but only add desired locations (while ignoring
errors)?
Type Qty1 Qty2 Qty3 Qty4 ...
apples 2 1 0 4
oranges 10 8 4 5
bananas 4 6 18 9
I know that it could be simply added (SUMPRODUCT+SUMPRODUCT+….) or use:
=SUMPRODUCT(--(ISNUMBER(MATCH(type,items,0))),((qty1)+(qty2))
But I need something better and one that will ignore #N/A errors since I am
using INDEX and MATCH functions to find the appropriate columns which may or
may not be present on data sheets given to me on a monthly basis. Here is
the formula that I am using, but if the data is not present for one or more
of my “qty†columns, it returns an error value.
=SUMPRODUCT(--(ISNUMBER(MATCH(INDIRECT("'"&$A4&"'!$B$5:$B$1000"),IHLCC,0)))*((INDEX(INDIRECT("'"&$A4&"'!$A$5:$Z$1000"),0,MATCH(C$2,INDIRECT("'"&$A4&"'!$A$3:$Z$3"),0)))+(INDEX(INDIRECT("'"&$A4&"'!$A$5:$Z$1000"),0,MATCH(D$2,INDIRECT("'"&$A4&"'!$A$3:$Z$3"),0)))+(INDEX(INDIRECT("'"&$A4&"'!$A$5:$Z$1000"),0,MATCH(L$2,INDIRECT("'"&$A4&"'!$A$3:$Z$3"),0)))))
If I use =IF(ISERROR(…) for each “qtyâ€, the formula is too long for my
version of Excel 2003
Column A ("'"&$A4&"'!)= contains monthly data sheet names which makes it
easier to fill the table
IHLCC = “items’ named range
C2, D2, L2 = ‘qty†lookup values
Thank you for your help!
Jeff