Thanks for the tip teylyn- will try remember to apply that next time!

Useful to know that the simpler SUMIF works too- I tried out this and got the right answer:

=SUMIF($P$104:$CF$170,A134,$S$104:$CI$170)