I'm close to solving this array formula but cannot do exactly what I need. Formula shown below:

=SUM(IF($TY$10:$TY$1001=$TY11,(INDEX($UE$10:$UE$1001,MATCH($TY11:$TY$1001,$TY$10:$TY$1001,0)))))

All part numbers in range $TY$10:$TY$1001. All inventory quantities in range $UE$10:$UE$1001. All I want to do is add all quantities matching specific part number. In the table below:

PART NUMBER.....QTYS..........RESULTS EXPECTED (FORMULA)

TY10=PARTA........UE10=1........UG10=1

TY11=PARTB........UE11=3........UG11=5

TY12=PARTB........UE12=2........UG12=5

TY13=PARTC........UE13=1........UG13=1

After checking for PARTB match, the array formula finds these in rows 11 and 12 in Excel sheet (or relatively to rows 2 and 3 in Index function) then sums those qtys from column UE (3 + 2 = 5) 5 is the result.

If TY11 part number's qty in UE11 changes from 3 to 2, then result will automatically sum and get 4 (from 5) for PART B.

The formula I'm using kind of works except it's summing number of matching part number instead of summing qtys. If I change/delete any qty matching PART B, it still shows sum = 5. However, if I delete part number "PARTB" from any one line, it decrements the total sum by one to 4.

Please help me.