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