Warm tip: This article is reproduced from stackoverflow.com, please click
excel excel-formula

Get Sum of Products in same column

发布于 2020-03-31 22:56:33

I have the below data set:

enter image description here

Let's assume it starts in A1. I would like to calculate the Total Costfor January by taking each Count and multiplying by the Rate below it.

I currently have the following, nonsensical formula:

Total Cost = (B1 * B2) + (B3 * B4) + (B5 * B6) + ... + (Bn + Bn+1) for n > 0

Is there a whizzy way to do this using an Excel formula? Perhaps something with SUMPRODUCT()? But I can't seem to get that to work the way I need it...

Questioner
Dean De Villiers
Viewed
34
JvdV 2020-01-31 19:46

Simplified example:

enter image description here

=SUMPRODUCT(--(A1:A5="Count"),B1:B5*B2:B6)