run_scenarios
Run what-if analysis by sweeping an input cell across multiple deterministic values, running a full simulation per value, and returning P5/P50/P95/mean for each scenario.
Instructions
ModelRisk: Sweep a single input cell across multiple deterministic values, running a full simulation at each. Returns per-output P5 / P50 / P95 / mean for every scenario value. Useful for what-if analysis: 'what if widget cost is $50 vs $75 vs $100'. The cell's original formula is captured before the sweep and restored afterwards (even on error), so the workbook ends in its pre-call state. Each scenario takes roughly the same time as one run_simulation call, so keep the values list short — 3-7 scenarios is a normal range.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cell | Yes | A1-style cell reference for the input to sweep. | |
| seed | No | Fixed seed (same seed across scenarios). | |
| sheet | Yes | Sheet name holding the input cell. | |
| values | Yes | Deterministic values to test (1-20 scenarios). | |
| samples | No | Iterations per scenario. | |
| workbook_name | No | Workbook name. Omit for the active workbook. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cell | Yes | ||
| sheet | Yes | ||
| scenarios | No | ||
| workbook_name | Yes | ||
| original_formula | No | ||
| samples_per_scenario | No |