Hi,
In G3, try:
=$A3-IFERROR(INDEX($A4:$A$12,SUMPRODUCT(($B4:$F$12=B3)* (ROW($B4:$F$12)-ROW($B4)+1))),0)
copied down and across.
If there is no match and you want blanks instead of the large numbers, then use
=IFERROR($A3-INDEX($A4:$A$12,SUMPRODUCT(($B4:$F$12=B3)*(ROW($B4 :$F$12)-ROW($B4)+1))),"")
|