Skolastix
Programmer
- Jul 31, 2001
- 22
I have used some to the threads to FINALLY come up with this formula:
=SUMPRODUCT((($B$4:$J$4=$A$23)+($B$4:$J$4=$A$24)+($B$4:$J$4=$A$25))*($B$9:$J$9))
...which allows me to add the values in different columns depending on the criterias addedd in Cells A23, A24 and A25.
Now my question: i am looking to simplify it using an array. I have encountered an example that uses one as per below:
----------------
Example 8: Count the instances of more than one value in a given range. This example is counting how many Fords and Chryslers are in the range A1:A10.
Solution: This can be solved by using OR as described in the previous example, but on a single range, that is
=SUMPRODUCT((A1:A10="Ford")+(A1:A10="Chrysler"))
But in this in stance, as we are looking for two values in a single range, it is better to test against an array of values, or
=SUMPRODUCT(--(A1:A10={"Ford","Chrysler"}))
---------------
...but it seems as though this example only works if the array is in the same column. Example: if the original equation was
=SUMPRODUCT((A4:J4="Ford")+(A4:J4="Chrysler"))
the formula:
=SUMPRODUCT(--(A4:J4={"Ford","Chrysler"}))
doesn't seem to work...
How can I use the example to simplify the SUMPRODUCT formula if the results are all in the same row (ex: row 4)
Any help would be appreciated. Thanks in advance
Stais
=SUMPRODUCT((($B$4:$J$4=$A$23)+($B$4:$J$4=$A$24)+($B$4:$J$4=$A$25))*($B$9:$J$9))
...which allows me to add the values in different columns depending on the criterias addedd in Cells A23, A24 and A25.
Now my question: i am looking to simplify it using an array. I have encountered an example that uses one as per below:
----------------
Example 8: Count the instances of more than one value in a given range. This example is counting how many Fords and Chryslers are in the range A1:A10.
Solution: This can be solved by using OR as described in the previous example, but on a single range, that is
=SUMPRODUCT((A1:A10="Ford")+(A1:A10="Chrysler"))
But in this in stance, as we are looking for two values in a single range, it is better to test against an array of values, or
=SUMPRODUCT(--(A1:A10={"Ford","Chrysler"}))
---------------
...but it seems as though this example only works if the array is in the same column. Example: if the original equation was
=SUMPRODUCT((A4:J4="Ford")+(A4:J4="Chrysler"))
the formula:
=SUMPRODUCT(--(A4:J4={"Ford","Chrysler"}))
doesn't seem to work...
How can I use the example to simplify the SUMPRODUCT formula if the results are all in the same row (ex: row 4)
Any help would be appreciated. Thanks in advance
Stais