Sumproduct with weekend day test

L

Loge

A2:A32 contains dates (in proper date-number format), and may contain up to 3
blanks (from A30:A32) depending on the length of the month in question.
C2:C32 contains names and will have the same number of blanks as the date
range.
A39 contains "H"
I need to find the number of occurrences where "H" is in the C column and
the date on the same line in the A column represents a weekend day.

I started to build the formula using only Saturday as a test but
=SUMPRODUCT(--(C2:C32=A39),(WEEKDAY(A2:A32,2)=6)) retuned a zero when there
was an "H" in the same row as Nov 15, 2008 (Saturday). The first array works
fine by itself, but I clearly don't understand how to set up the second aray.

Please show me the correct way, especially to include both Satudays and
Sundays in the result.

Thanks!
 
K

Ken Johnson

A2:A32 contains dates (in proper date-number format), and may contain up to 3
blanks (from A30:A32) depending on the length of the month in question.
C2:C32 contains names and will have the same number of blanks as the date
range.
A39 contains "H"
I need to find the number of occurrences where "H" is in the C column and
the date on the same line in the A column represents a weekend day.

I started to build the formula using only Saturday as a test but
=SUMPRODUCT(--(C2:C32=A39),(WEEKDAY(A2:A32,2)=6)) retuned a zero when there
was an "H" in the same row as Nov 15, 2008 (Saturday).  The first arrayworks
fine by itself, but I clearly don't understand how to set up the second aray.

Please show me the correct way, especially to include both Satudays and
Sundays in the result.

Thanks!

=SUMPRODUCT((C2:C32=A39)*(WEEKDAY(A2:A32,2)>5))

or include the double unary for the 2nd argument...

=SUMPRODUCT(--(C2:C32=A39),--(WEEKDAY(A2:A32,2)>5))

Ken Johnson
 
L

Loge

Perfect - Thanks!

I don't understand the double unary. What, exactly, is the math behind it?
Do you have a good reference on the double unary or the SUMPRODUCT function?
 

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