in reply to Help with formula in excel

$Sheet->Range("H$lastrow4")->{Formula} = '=sum("H17:H.$Lastrow3")';

Try this instead:

$Sheet->Range("H$lastrow4")->{Formula} = qq{=sum("H17:H.$Lastrow3")};

(Look in perlop for qq.) The problem you had is that you were trying to interpolate a variable ($Lastrow3) into a single quoted string (which does not do variable interpolation).