LINEST function

LINEST(KnownYValues, KnownXValues?) LINEST(KnownYValues; KnownXValues?)

KnownYValues

{ Number }

The set of known vertical values. This array must have the same size as the knownXValues parameter, if that parameter is provided.

KnownXValues

{ Number } (optional)

The set of known horizontal values. If provided, this array must have the same size as the knownYValues parameter. If omitted, this parameter is assumed to be equivalent to SEQUENCE(SIZE(knownYValues))SEQUENCE(SIZE(knownYValues)): { 1, 2, 3, ... }{ 1; 2; 3; ... }.

Returns

{ Number }

An array containing two values corresponding to m and b in the equation y = x * x + b, describing a straight line that best fits the given data.

Finds a straight line, y = m * x + b, that best fits the given data, and returns an array containing two values corresponding to m and b in the equation above. This function uses linear regression.

Example

LINEST({ 4, 5, 6 }, { 130, 135, 140 })LINEST({ 4; 5; 6 }; { 130; 135; 140 })

Returns the array { 0.2, -22 }{ 0,2; -22 }.