which sum function do I use for multiple criteria

smgomez

Board Regular
Joined
Nov 13, 2009
Messages
63
I have the following information:
1650297133648.png

I previously posted a question to solve for cell F17 and received a response that solved that. I believe the right method is to now post a new question for a formula in cell E17 which seems to be a little more complicated and I can't seem to get what I have tried to work: I need a formula that adds column B and C and subtracts column D where B17 is not blank and where column A = A17. The answer should be 416.29. Thanks
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
sum(B2:C16)
will give the sum of the 2 columns - is that what you meant....
Then only remove the sum of D , where B17 is not blank and A =17
Which seems wrong to me

SUMIF() and SUMIFS()
maybe what you are after

=IF( B17<>"",sum(B2:C16) - SUMIFS( D2:D16, A2:A16, A17), "")

maybe useful to refer to the other question
in case it helps

Note: Images are difficult to see , and also requires that I input all the data myself, which is very time consuming.

A SMALL sample spreadsheet, around 10-20 rows, would help a lot here, with all sensitive data removed, and expected results mocked up and manually entered, with a few notes of explanation.

MrExcel has a tool called “XL2BB” that lets you post samples of your data and will allow us to copy/paste your sample data into our Excel spreadsheets, saving a lot of time.

You can also test to see if it works ok, in the "Test Here" forum.

OR if you cannot get XL2BB to work, or have restrictions on your PC , then put the sample spreadsheet onto a share
I only tend to goto OneDrive, Dropbox or google docs , as I'm never certain of other random share sites and possible virus.
 
Upvote 0
IF( B17<>"",sum(B2:C16) - SUMIFS( D2:D16, A2:A16, A17), "")
Almost. When summing columns B & C, column A also needs to equal A17 so that rows 2 and 3 are excluded. That is where I keep getting stumped in this formula.
 

Attachments

  • Capture.PNG
    Capture.PNG
    37.4 KB · Views: 1
Upvote 0
IF( B17<>"",sumIf(A2:A16,A17,B2:B16) +sumIf(A2:A16,A17,C2:C16) - SUMIFS( D2:D16, A2:A16, A17), "")

or we could use a sumproduct - but that should do
 
Upvote 0
Solution

Forum statistics

Threads
1,214,376
Messages
6,119,172
Members
448,870
Latest member
max_pedreira

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top