Try

=B2-SUMIF($A$23:$A$1000,A2,$D$23:$D$1000)

Copy down

I could not work out how you calculated your figures.

The above totals data in D23 down for item A2 and subtracts from inventory in B2

so for "Camo" is 100 items (40+60) leaving a balance of 50