This is more like giving fish rather than teaching to fish BUT I had a hard time implementing this myself for my idle game so I wanted to share. Download the sa...
Thanks, if it did not work it could be because you've hit the number limit from Construct or you may have forgotten to increase Array size.
If you want to change how many digits you want to show (before units like changing 1m to 1000k) you should play around with the denominator (1000 / 100 / 10 as default) in the formula AND change the "+3" value at the second part of the same formula.