My data:
A B C
a 3 d
b 1 a
c 8 e
d 5
I want to use SUMIFS
function, sum range is B1:B4
, if the corresponding value in column A
exists in column C
, sum the values in column B
,
in this case the sum will be 3 + 5 = 8
I tried =SUMIFS(B1:B4,A1:A4, COUNTIF($C$1:$C$3,A1)
but I get zero.
=SUMPRODUCT(SUMIF(A1:A4,C1:C3,B1:B4))
Link for further reading: COUNTIFS: Multiple “OR” Criteria For One Or Two Criteria_Ranges
What you want is this:
=SUMIFS(B1:B4,A1:A4,A1)
Edit:
I know you asked for a sumif, but that doesn't want to work, entering the below as an array formula (CTRL+SHIFT+ENTER
) does the trick.
=SUMPRODUCT(B1:B4,(IFERROR(MATCH(A1:A4,C1:C4,0),0)>0)*1)