ReferenceFunctionsStatistics Functions
LINEST
LINEST: Returns linear-regression coefficients and optional fit statistics.
Summary
LINEST fits a straight line to known y/x pairs and returns either [slope, intercept] or a
larger statistics matrix.
Remarks
known_yis required;known_xdefaults to1..nwhen omitted.constcontrols whether an intercept is fitted (TRUEby default).stats=TRUEreturns a5x2result block; otherwise it returns1x2.- Returns spreadsheet errors for mismatched lengths, empty data, or degenerate x-values.
Examples
Slope and intercept only
Grid
| Cell | Value | |
|---|---|---|
| No inputs on Sheet1. | ||
Formula
=
Result
Not evaluated yet.
Expected
[[2,0]]
Linear fit with non-zero intercept
Grid
| Cell | Value | |
|---|---|---|
| No inputs on Sheet1. | ||
Formula
=
Result
Not evaluated yet.
Expected
[[2,1]]
Related functions
Runtime metadata
Category
Statistics
Signature
LINEST(arg1…: Number (Range))This function accepts a repeating argument pattern (min args: 1).
Arity
min 1, max variadic
Arguments
arg1Number · Range · coercion NumberLenientText
Caps
PURENUMERIC_ONLY
Source