Why not create a helper column that has a subtotal of each TYPE. so then you can VLOOKUP that helper column that already has the total?