You're welcome.
If you think about how this syntax works
SUM(SUMIFS(C$2:C$11,A$2:A$11,D2,B$2:B$11,{"apple","banana"}))
It's essentially doing 2 sumifs formulas (1 for apple, 1 for banana), and summing the results of each.
A shortcut for
SUM(SUMIFS(C$2:C$11,A$2:A$11,D2,B$2:B$11,"apple"),SUMIFS(C$2:C$11,A$2:A$11,D2,B$2:B$11,"banana"))
Similarly, in the initial IF I used this
SUM(--(COUNTIFS($A$2:$A$11,D2,$B$2:$B$11,{"apple","banana"})>0))
This is adding the >0 operator to each countifs and returning True or False for them.
The -- is converting the true/false to 1/0
Then it's summed.
Basically doing
SUM(--(COUNTIFS($A$2:$A$11,D2,$B$2:$B$11,"apple")>0),--(COUNTIFS($A$2:$A$11,D2,$B$2:$B$11,"banana")>0))
Only if both are true will that sum =2
If that sum does =2, then do the sum(sumifs
Hope that helps.
Bookmarks