# LINEST

LINEST(known_y's [,known_x's] [,const] [,stats])

Returns the array of values for a straight line that best fits your data.

 known_y's The set of y-values for the equation (y = mx + c). known_x's (Optional) The set of x-values for the equation (y = mx + c). const (Optional) A logical value indicating whether the constant c is to equal 0:True = c is calculated normally (default)False = c is equal to 0. stats (Optional) A logical value indicating whether to return additional regression statistics:True = additional regression statistics are returnedFalse = only the m-coefficients and the constant b are returned (default)

 REMARKS
 * This function always returns multiple values.* For an illustrated example refer to the page under Advanced Functions* This function had to be entered as an Array Formula before Excel 2021.* Calculates the statistics for a line by using the "least squares" method.* If "known_y's" is in a single column, then each column of "known_x's" is interpreted as a separate variable.* If "known_y's" is in a single row, then each row of "known_x's" is interpreted as a separate variable.* The "known_x's" can include one or more sets of variables.* If "known_x's" is left blank, it is assumed to be the array {1,2,3,} that is the same size as "known_y's".* If "const" = True, then c is calculated normally.* If "const" = False, then c = 0 and the equation (y = mx) is used.* If "const" is left blank, then True is used.* If "stats" = False, then only the m-coefficients and the constant b are returned.* If "stats" = True, then Additional Regression Statistics are returned.* If "stats" is left blank, then False is used.* If only one variable is used, "known_y's" and "known_x's" can be ranges of any shape, as long as they have equal dimensions.* If more than one variable is used, "known_y's" must be a vector (that is, a range with a height of one row or a width of one column).* In Excel 2010 the accuracy of this function was improved.* For the Microsoft documentation refer to support.microsoft.com

 A 1 {=LINEST({1,9,5,7},{0,4,2,3},True,False) } = {2,1} 2 {=LINEST({1,9,5,7},{0,4,2,3},False,False) } = {2.31,0} 3 {=LINEST({1,9,5,7},{0,4,2,3},True,True) } = {2.31,0;0.11,#N/A;0.99,0.63;384,3;154,1.2}