How do you get the sum of all values of A if it has "foo" in column B? In the example below the sum should be 8.
If you want, you can apply the criteria to one range and sum the corresponding values in a different range. For example, the formula =SUMIF(B2:B5, "John", C2:C5) sums only the values in the range C2:C5, where the corresponding cells in the range B2:B5 equal "John."
Excel allows us to sum all values from a table that contain both x and y by using the SUMIFS function.
The first step is to specify the location of the numbers: =SUMIFS(D2:D11, In other words, you want the formula to sum numbers in that column if they meet the conditions. That cell range is the first argument in this formula—the first piece of data that the function requires as input.
SUMIF can evaluate just one condition at a time while SUMIFS can check for multiple criteria. Syntax. With SUMIF, the sum_range is the last and optional argument - if not defined, the values in the range argument are summed.
try this
=SUMIF(B:B,"foo",A:A)
If you want to sum a range of cell, as in your example:
=SUMIF(B1:B5, "foo", A1:A5)
Syntax: SUMIF(range, criteria, sum_range)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With