[]
        
(Showing Draft Content)

What-If Analysis

What‑If Analysis is a modeling technique used to evaluate how changes in one or more input values affect the result of a formula.

Instead of manually modifying cells and recalculating repeatedly, What‑If Analysis allows you to systematically explore different scenarios and observe how results respond to varying assumptions.

SpreadJS provides two complementary approaches to perform What‑If Analysis:

  • Data Table Analysis using the SJS.TABLE worksheet function

  • Goal Seek Analysis using the GC.Spread.Sheets.CalcEngine.goalSeek method

Although both features support scenario‑based evaluation, they serve different purposes and operate differently.

Data Table Analysis (SJS.TABLE)

SJS.TABLE evaluates a result cell or range across multiple input combinations and returns the collected results as a dynamic array.

It is implemented as a standard worksheet formula, which means it:

  • Participates in normal worksheet recalculation

  • Can be edited, copied, and nested inside other functions

  • Automatically spills results into adjacent cells

In addition, SJS.TABLE:

  • Supports dynamic arrays and inline arrays

  • Allows multiple input variables in a single formula

  • Supports cross‑sheet references and named ranges

Data Table Analysis is best suited for comparing outcomes across predefined sets of input values.

Goal Seek Analysis

goalSeek is an imperative calculation method that adjusts the value of a specified cell until a formula reaches a desired target result.

Unlike SJS.TABLE, Goal Seek:

  • Modifies the changing cell directly

  • Uses an internal numerical solving algorithm

  • Returns a boolean or Promise<boolean>

  • Operates through the CalcEngine API rather than a worksheet formula

Goal Seek is best suited for solving inverse problems, such as determining what interest rate produces a specific payment amount.

Comparison

Feature

Data Table (SJS.TABLE)

Goal Seek (goalSeek)

Type

Worksheet formula

CalcEngine API method

Execution model

Declarative

Imperative

Primary purpose

Evaluate multiple input combinations

Find an input value for a target result

Returns

Dynamic array

boolean or Promise<boolean>

Modifies worksheet cells

No

Yes

Related Topics

Topic

Description

SJS.TABLE Function

Syntax, parameters, and common usage patterns

Input and Result Rules

Detailed rules for output size and input matching behavior

Performance and Calculation

Controlling recalculation and monitoring progress

Excel Compatibility

Import and export behavior and compatibility limitations

Goal Seek

API reference and solving behavior

Using What‑If Analysis in SpreadJS Designer

In SpreadJS Designer, What‑If Analysis tools are available on the What‑If Analysis menu.

Options include:

  • Goal Seek

  • Data Table

image

For details about the Designer interface and configuration workflow, see What-If Analysis.