IF(r < 10,(n - r + 1), 0) + nh

I'd looked at Phaze's formula and at 1st glance it looked ok and as he's normally pretty consistant with his formulas, never checked it. My formula was slightly different and not quite so compact, (n-r+1)+nh+IF(r=10,-1) so didn't bother posting it.