How to sum values that equal one of many potential criteria; this is basically summing with an OR condition.
This is not the same as using the SUMIFS() function because that function only sums values that meet every condition within it.
=SUMIF(A1:A5,"red",B1:B5)+SUMIF(A1:A5,"black",B1:B5)
This formula sums the numbers for the colors red and black.
The trick is that it is actually two SUMIF functions that are added together within the cell. It's the same as placing one SUMIF function for the red values in one cell and another function in another cell for the black values and then adding the results together.
There is a plus sign in-between both functions and that's what allows them to be in the same cell and added together.
(I'm assuming that you're already familiar with how the SUMIF function works.)
Result:
You can continue to add as many SUMIF functions to this formula as you want, basically.
In fact, you can even use this method to subtract, divide, or multiply values based on criteria; simply replace the plus sign with one of the other signs.
If you want to sum values based on multiple criteria across multiple columns using this sort of OR condition, check out our tutorial on how to sum values that equal 1 of many conditions across multiple columns.
Make sure to download the sample file for this tutorial to work with the above example in Excel.