That formula is
f = d * I / (I + O)where f[m] denotes the required focal length to picture an image with the width of O[m] on the sensor with the width of I[m] when the object is d[m] away from the camera.
For my Canon EOS 400D camera with a sensor dimension of 22.2mm x 14.8mm a sample calculation could look like this:
I would like to picture an object that is 20cm wide and 1m away from my camera. So I set d = 1m, O = 0.02m and I = 0.0148m (sensor width).
Inserting into the formula from above this gives me a focal length of f=0.0689m or 69mm.
This formula is valid for all cameras (just find out your sensor dimensions) and all lenses.