A few approaches... based entirely on your sample (ie unique items, results in same order etc...)
=SUM(B2:INDEX(B2:E2,$B$7))
copied down
or
=SUM(OFFSET(B2,,,1,$B$7))
copied down
(the latter is Volatile)
edit: given your edit - if the items are unique (appear once)
=SUM(INDEX($B$2:$B$4,MATCH($A8,$A$2:$A$4,0)):INDEX($B$2:$E$4,MATCH($A8,$A$2:$A$4,0),$B$7))
=SUM(OFFSET($B$2,MATCH($A8,$A$2:$A$4,0)-1,,1,$B$7))
Bookmarks