sumproduct in a range

G

Guest

I have 27 columns. The first column refers to a calendar year ie 2003, 2004.
There are multilple occurences of the same year in this column. The rest of
the columns may or may not have numbers in the cells.

I would like to count the cells that do have numbers that correspond to the
year selected.

I'm not too sure how to use the sumproduct function but this is the formula
I created and doesn't work:
=SUMPRODUCT(--(A12:A24=W34),--(B12:BA24>0))

W34 indicates the year I would like the used cells counted.
Assistance is mighty appreciated.
 
P

Peo Sjoblom

One way

=SUMPRODUCT((A12:A24=W34)*(B12:BA24>0))

using excel built in method of (--(range=x),--(range=y)

will not work if the ranges have different sizes

--
Regards,

Peo Sjoblom

(No private emails please)
 
A

Arvi Laanemets

Hi

=SUM(IF($A$12:$A$24=W34,$B$12:$BA$24,0))
entered as an array formula (Ctrl+Shift+Enter)


Arvi Laanemets
 
A

Aladin Akyurek

Tat said:
I have 27 columns. The first column refers to a calendar year ie 2003, 2004.
There are multilple occurences of the same year in this column. The rest of
the columns may or may not have numbers in the cells.

I would like to count the cells that do have numbers that correspond to the
year selected.

I'm not too sure how to use the sumproduct function but this is the formula
I created and doesn't work:
=SUMPRODUCT(--(A12:A24=W34),--(B12:BA24>0))

W34 indicates the year I would like the used cells counted.
Assistance is mighty appreciated.

You have to switch to the comma syntax to the "star" syntax:

=SUMPRODUCT((A12:A24=W34)*(B12:BA24>0))

if B12:BA24 does not house any text values.

Otherwise, one of:

=SUM(IF(A12:A24=W34,IF(B12:BA24>0,1,0)))

=SUM(IF(A12:A24=W34,IF(ISNUMBER(B12:BA24)*(B12:BA24>0),1,0)))

which must be confirmed with control+shift+enter instead of just enter.

--

[1] The SumProduct function should implicitly coerce the truth values to
their Excel numeric equivalents.
[2] The lookup functions should have an optional argument for the return
value, defaulting to #N/A in its absence.
 
G

Guest

Tried it but didn't work.
Used =Sum(IF(a12:a24=w34,if(b12:ba24>0,1,0))) that A.Akyurek suggested with
cntrl +shift+enter. That worked.

Thanks for your efforts.
 
G

Guest

Tried it but didn't work.
Used =Sum(IF(a12:a24=w34,if(b12:ba24>0,1,0))) that A.Akyurek suggested with
cntrl +shift+enter. That worked.

Thanks for your efforts.
 
G

Guest

Thanks for your suggestion with conditional sum if. That worked. (sumproduct
did not).

Have a good one!

Aladin Akyurek said:
Tat said:
I have 27 columns. The first column refers to a calendar year ie 2003, 2004.
There are multilple occurences of the same year in this column. The rest of
the columns may or may not have numbers in the cells.

I would like to count the cells that do have numbers that correspond to the
year selected.

I'm not too sure how to use the sumproduct function but this is the formula
I created and doesn't work:
=SUMPRODUCT(--(A12:A24=W34),--(B12:BA24>0))

W34 indicates the year I would like the used cells counted.
Assistance is mighty appreciated.

You have to switch to the comma syntax to the "star" syntax:

=SUMPRODUCT((A12:A24=W34)*(B12:BA24>0))

if B12:BA24 does not house any text values.

Otherwise, one of:

=SUM(IF(A12:A24=W34,IF(B12:BA24>0,1,0)))

=SUM(IF(A12:A24=W34,IF(ISNUMBER(B12:BA24)*(B12:BA24>0),1,0)))

which must be confirmed with control+shift+enter instead of just enter.

--

[1] The SumProduct function should implicitly coerce the truth values to
their Excel numeric equivalents.
[2] The lookup functions should have an optional argument for the return
value, defaulting to #N/A in its absence.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top