Google states that SUMPRODUCT "calculates the sum of the products of corresponding entries in two equal-sized arrays or ranges".
What I want to do is get the sum of the products of corresponding entries in two unequal-sized arrays. Such a thing can be accomplished with Excel:
=SUMPRODUCT((WEEKDAY(A1:Z1,2)>5)*(A2:Z10="self"))
This will display a sum of all the times when "self" occurs in rows 2 through 10 where row 1 is a weekend. In Google Spreadsheets, the equivalent should be
=ArrayFormula( SUMPRODUCT(WEEKDAY(A1:Z1,2)> 5, A2:Z10="self" ) )
However because Google Spreadsheets can only accept equal-sized arrays, this will fail. So as I see it I have three options:
- Insert 8 more rows between row 1 and 2 with a copy of all the dates from row 1
- Redo the formula with 8 sums, ex.:
=ArrayFormula( SUMPRODUCT(...)) + ArrayFormula( SUMPRODUCT(...)) ...etc...
- Find another formula that will work more efficiently
So the question boils down to point 3 - what other formulas could I use to make an array sum of rows 2 through 10 so that I can multiply them inside of SUMPRODUCT? Or is there another function that would help me accomplish the same thing?
Thanks!