What exactly do you need to tweak - the first part (G6*B17*A17)?
Something like
=Sum(G6* (IF(B17=1, A17*g17, IF (B17>1, A17*b17, b17))), If(E28=E17,-G28),(If(E29=E17,-G29*B29)))
your formula is not correct for Excel. your formula needs to be like this:
=if(b17=1,a17*g17,if(b17>1,a17*b17,if(e28=e17,-g28,if(e29=e17,-g29*b29,b17))))
I am not quite sure what you are trying to do with the "Sum(g6*". The point here is, that you must use a new IF statement for each argument. you may have up to seven IF THEN statements, but no matter how many IF THEN statements you make, you can have only one ELSE statement.
Cheers,
-thomas