Why AGGREGATE over SUMIF?

You can use this:

=SUMIF(C2:C15,C17,D2:D15)