Format number through scripting

Perhaps you can get Nick to share his code from this topic: