You got it wrong. If you have 400px of content and only 100px is displayed, then the scrollbar should have length of 25% of max length. Therefore length = maxval/val * 100 (if you need it in percent, otherwise don't multiply it by 100).
Actually, no.
If I do maxval/val * 100 it will not work.
Consider that I have only one item added (say 32x32 image), while the view is 800px height.
800/32*100 = 2500%
Right.
While my example returns the following (*100 is optional):
(800-32)/800 * 100% = 96%
96% of full grabby's size. Not 2500%.
So, roc was right that I was right

Maybe I'm misreading this, but you want the size of the grabby part of the scrollbar to increase as the ratio of view size/content size decreases? Won't that raise all kinds of hell when you have a real length of 2, a max length of 400 and only 1-4% of the scrollbar gutter to divide those remaining 398 content unit thingies up amongst?
I didn't want to mess it up adding that I'd make an condition statement to check if size isn't too small. (if percent < smallest_acceptable then percent = smallest_acceptable)
view_size / max_size isn't proper either.
I don't know whether we don't understand eachother, or whatever, but I think my solution works for me just fine.
Final expression's thought:
The bigger difference between max view and actual view, the bigger thumb's size. (That grabby thing)
Anyways, got it working with my expression sample.
Cheers.