I want to write excel formula that will sum the values based on a match of the rows. The cells to be matched can occur multiple times and basing on the Mapping legend they should return the sum of values.

In the yellow cells I am trying to calculate sum of values in range B9:B21 based on a match of the names in G3:G8 according to Mapping legend to Item1, then Item2 and Item 3.
I got already answer on how to sum the values if array to be summed is the same as Mapping legend. But now my array to be summed in extended and SUMPRODUCT formula does not work anymore:

[![enter image description here](https://i.stack.imgur.com/N9rvY.png)](https://i.stack.imgur.com/N9rvY.png)

Is there a solution to that?