#### Mightystomp

##### New Member

- Joined
- Jan 31, 2006

- Messages
- 48

=SUMPRODUCT(--(D4:D12="Apples");SUM(E4:F12))

What i am trying to achieve is that it multiplies the 0 or 1 resulting from the D4 check with the sum of E4:F4, then the 0 or 1 from the D5 check with the sum of E5:F5 etc.

As it is it calculates the sum(E4:F12) as one value and not an array.

Same problem arises when trying a vlookup in the same way

=SUMPRODUCT(E4:E12;VLOOKUP(D4:D12;Priser!$F$3:$R$5;2;0))

I am trying to get it to multiply the E4 value with the value found of vlookup(D4;Priser!$F$3:$R$5;2;0)m then add the product of E5 multiplied with the result of vlookup(D5;Priser!$F$3:$R$5;2;0) etc.

What I am really trying to to is calculating YTD Sales in a data set with critera the first columns then units sold in Jan, Feb etc in the following columns. Prices are in another data set.

I know I can do it quite easily if using multiple cells to do the calculation. Im just curious if it can be all done in one cell.

Thank you