Goal seek¶
For one-dimensional what-if ("what input makes this output equal X?"), use :goal:
:goal B10 = 100 by A1 auto-bracket from A1's current value
:goal B10 = 0 by A1 in -50:50 explicit search bracket
Uses bisection over Grid.recalc(), which converges in milliseconds at spreadsheet scale. The variable cell must be empty or hold a number. The target and any bracket must be finite. The tolerance is relative to the size of the target and the variable. If the variable already hits the target, the search converges in zero steps. On success the variable cell is overwritten; u rolls back.
Unlike :opt, goal seek is not persisted in the workbook -- the three arguments fit on one line, so retyping is faster than naming.
Bisection is slow asymptotically, but correctness, simplicity, and graceful failure on non-monotonic or noisy formulas are worth more here than the iteration count. The reasoning is in the module docstring: see the goalseek API reference.