I don't think you are going to get a "user-defined function" (UDF) to work this way. A UDF cannot call the goal seek utility and get it to run. Entering a UDF into the "set cell" would also replace the formula in that set cell, which I assume is the formula you would like to "find the root" of.

I think the closest thing to what you describe would be a change and/or calculate event procedure that invokes goal seek when the spreadsheet changes or calculates.

When I have wanted to do this, I have written my own root finding algorithm for the problem in VBA. (

https://en.wikipedia.org/wiki/Root-finding_algorithm ) Usually I use the Newton Raphson method, but I have also used bisection or secant methods as well.

I don't know if it would apply to your specific problem, but I see a lot of problems like this where the user was just unwilling to solve the problem algebraically. I realize that algebra cannot solve all problems, but it is a little surprising to me how many of these problems would be easiest to solve if the user would dust off the algebra they learned way back in school.

I'm not sure we can say much more than that without a more detailed description of the problem you are trying to solve.

## Bookmarks