You are welcome.
Depending on the precison you need you may also consider to replace the simple linear interpolation by something else. See attached sheet for cubic splines interpolation and a couple of approximations (polynomial, exponential. logistic regression). The approximations don't do that well but if you have an idea what kind of function your Soil.max(depth) could be, you might try genfit().