There are a million ways you could do it.
Maybe add a column to the cart for "ChargeShipping" and set it to 0 or 1 based on whether you charge shipping or not, then add a calculation for "ShipWeight" = [Weight] * [Quantity] * [ChargeShipping]. Then you can use the total of that column when calculating the shipping which won't include the weights of items where you don't charge shipping.
That way you could use the total of the ShipWeight column to