Formualizer Docs

FORECAST.LINEAR

Returns a predicted y-value at x from simple linear regression over known data.

FORECAST.LINEAR fits y = intercept + slope * x and evaluates that line at the requested x.

The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.

Syntax

=FORECAST.LINEAR(x, known_ys, known_xs)

Arguments

ArgumentTypeRequiredDefault
xnumber (range)Required—
known_ysnumber (range)Required—
known_xsnumber (range)Required—

Remarks

  • Requires known_y and known_x arrays with the same numeric length.
  • Alias FORECAST is supported.

Error cases

  • Returns #N/A when arrays are empty or lengths do not match.
  • Returns #DIV/0! when known_x has zero variance.

Examples

Extend a linear pattern one step beyond the observed x range.

Formula =FORECAST.LINEAR(5,{2,4,6,8},{1,2,3,4})

Expected result 10

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Interpolate between two observed x values.

Formula =FORECAST.LINEAR(2.5,{2,4,6,8},{1,2,3,4})

Expected result 5

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Evaluate at the first x value of a two-point line.

Formula =FORECAST.LINEAR(1,{2,4},{1,2})

Expected result 2

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Each known y must have a corresponding x.

Formula =FORECAST.LINEAR(5,{2,4,6},{1,2})

Expected result #N/A

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Predict next point on a perfect line

Formula =FORECAST.LINEAR(4,{2,4,6},{1,2,3})

Expected result 8

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Forecast with non-zero intercept

Formula =FORECAST.LINEAR(5,{3,5,7},{1,2,3})

Expected result 11

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Implementation

Engine source

On this page