# sumproduct error

L

#### LUIS ANGEL

Hi,

I cant seem to get this working. Farely simple I think. Im trying to
have sumproduct sum what corresponds to a specific number. Here is my
example:

Im getting a #VALUE error. Any thoughts?

In this example the C cell should give the sum of all 2010's (=30)

A B C
2010 2 =SUMPRODUCT(--(\$A\$1:\$B\$24="2010"),\$B\$1:\$B\$24)
2011 3
2012 4
2013 5
2014 6
2015 7
2016 8
2017 9
2010 10
2011 11
2012 12
2013 13
2014 14
2015 15
2016 16
2017 17
2010 18
2011 19
2012 20
2013 21
2014 22
2015 23
2016 24
2017 25

J

#### joeu2004

Im getting a #VALUE error. Any thoughts?
In this example the C cell should give the sum of all 2010's (=30)
A                B             C
2010    2            =SUMPRODUCT(--(\$A\$1:\$B\$24="2010"),\$B\$1:\$B\$24)
2011    3

First, the formula should be at least:

=SUMPRODUCT(--(\$A\$1:\$A\$24="2010"),\$B\$1:\$B\$24)

Note the change in the first range.

Second, if A1:A24 contains numbers (most likely), the formula should
be:

=SUMPRODUCT(--(\$A\$1:\$A\$24=2010),\$B\$1:\$B\$24)

Note: no quotes around 2010.

Finally, you can use SUMIF in this case, and it would be better to do
so. To wit:

=SUMIF(\$A\$1:\$A\$24,2010,\$B\$1:\$B\$24)