I would avoid using scripts to apply formatting and use native excel formula instead. In a new column use this pseudo code if( round down to integer <> original value then text( original value, "#.###") else text( original value, "#"))
if( round down to integer <> original value then text( original value, "#.###") else text( original value, "#"))