[Solved] Conditional sum of the product of two columns

Discuss the spreadsheet application
Post Reply
User avatar
josephj
Posts: 45
Joined: Fri Mar 28, 2008 7:29 pm
Location: Northeastern USA

[Solved] Conditional sum of the product of two columns

Post by josephj »

How can I do this?

If column A contains 'ABC', then I want to multiply column B by column C and sum it.

I could create a scratchpad column of B*C and conditionally sum that, but can I do it without the scratchpad?

Something like the following would work with D as the scratchpad column.

Code: Select all

=SUMIF($A$9:$A$55,"ABC",$D$9:$D$55)

Code: Select all

A   B C
ABC 2 3
DEF 4 5
ABC 1 5
XYZ 9 8
yields

(2*3) + (1*5) = 11
Last edited by josephj on Fri Jan 11, 2019 9:35 am, edited 1 time in total.
FJCC
Moderator
Posts: 9280
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Conditional sum of the product of two columns

Post by FJCC »

This is what the SUMPRODUCT() function is for

Code: Select all

=SUMPRODUCT(A9:A55 = "ABC"; B9:B55; C9:C55)
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Post Reply