I have number in coppers: there are 100 coppers to a silver and 100 silvers to a gold
I need the raw number to stay in the cell so it can be used in calculations.
Ideal format:
- 1 ==> 1c
- 123 => 1s 23c
- 12045 => 12g 4s 45c
- 1234507 => 123g 45s 7c
The best custom format I can come up with is:
#0"g "00"s "00"c"
which give this:
- 1 ==> 0g 00s 01c
- 123 => 0g 01s 23c
- 12045 => 12g 04s 45c
- 1234507 => 123g 45s 07c
This is OK but I wonder if it can be done better?
There are a few undocumented format characters but I don't know what they do
Best Answer
With the following piece of code you can style whatever number you want.
Code
Explained
The onOpen() will create a new menu entry. The myFormat will accept the selected reange and spit out the desired format.
Add the script under Tools>Script editor. Press the bug button to authenticate the script and you're on the go !!