Excel formula to calculate the sum of the products of values in two different columns of qualifying rows.

Hello,

This post has two related questions:

Question #1)
What formula in Excel will display the sum of only those values in a given column which have a value (any value) in the same row of a defined adjacent column?

I am familiar with the =SUMIF() formula which returns the sum of those values in a given column which have a specified value in the same row of an adjacent column as shown in the following screenshots (Fig. 1)

Fig. 1However, suppose you want a similar result but instead of specifying a value in the adjacent column, you want the sum of values which have an adjacent entry regardless of its value as shown here (Fig. 2):

Fig. 2In this case, the formula in cell D13 should display the result 18 since that is the sum (as shown to the side) of the values in column D which have an adjacent entry in column C.

Question #2)
Now, what Excel formula in cell D13 will use the same criteria as previously (ie the presence of some entry in the same row of the adjacent column) but instead of a simple sum, will return the sum of the products of the qualifying values in column D and their corresponding values in column C (Fig. 3)?

Fig. 3In this case as previously, only those rows with entries in column C are included in the calculation but the desired result is the sum of the products of adjacent values in columns C & D, as shown again to the side.

Thanks
WeThotUWasAToadAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
here is part 1:
=SUMIF(C4:C12,">0",D4:D12)

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Missus Miss_SellaneusCommented:
Take a look at the SUMIFS function.. it's more powerful than SUMIF. You can use SUMIFS to incorparate adjacent cells. In your second example you could use something like "=SUMIFS(....) * SUMIFS(...)", multiplying the sums of the 2 columns instead of adding the products, which will yield the same result.
0
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
here is part 2:
=SUMPRODUCT((C4:C12>0)*(C4:C12),D4:D12)

Open in new window

0
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
did the formulas I posted work for you?
0
Martin LissOlder than dirtCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.