you can also use SUMPRODUCT() function to achieve this result.
=SUMPRODUCT((A2:C9="foo")*(D2:D9=1)*(E2:E9=2))
output = 2.0