There is the SUMIF formula, but I don't recall if you can use two variables or not. You might be able to use it in stages. If one is true, copy the number to a separate column, else zero. Use a sumif for the second variable off the separate column. You might be able to put one IF statement inside another, but that would mean large formula and staging it might be easier to troubleshoot later. You can hide the columns you don't need displayed.
There are pivot tables also that can do multivariable sorting, but I never got much practice using them so I couldn't tell you much.
If has been 5 or more years since I had to deal regularly with large spreadsheets for environmental reporting. I am rusty on that stuff.
Edit: Sounds like you got it.