It would seem that a sumproduct would work if the "C" was replaced by a formula that found the column that has the values of C2 and D2, in rows 5 and 6 respectively. It may need the ADDRESS function to do that, but I can't make it work. It would be something like:
=SUMPRODUCT(($A$7:$A$26=A2)*($B$7:$B$26=B2)*(address(7,[insert formula]):address(26:[insert formula])))
If someone can make a formula that figures out the column that matches cell C2 and D2 in his example, then inserting it into the above formula should work.
Bookmarks