LINEST Function
Return the statistics of the straight line that best fits the data, by the least squares method. known_y holds the dependent values and known_x the independent ones (1, 2, 3 and so on when omitted). const TRUE or omitted calculates the intercept and FALSE sets it to 0, and stats TRUE adds rows of regression statistics, such as the standard errors and R². The result is an array that spills, with the slope first and the intercept second.
Syntax
LINEST(known_y, known_x, const, stats)
Category: Statistics. Minimum arguments: 1. Maximum arguments: 4.
Available for supported offline calculation.
Examples
=LINEST({2;4;6},{1;2;3})
The formula returns the slope 2 and the intercept 0 in two cells of a row, because the values 2, 4 and 6 lie on the line y = 2x.
Cell and range examples require appropriate input values in the referenced cells. Handle invalid arguments, formula errors and array and spill constraints.