# How to use the LINEST function in Excel In this article, we will learn How to use the LINEST function in Excel.

Equation of line:

If there is a single range of x-values, the calculated line satisfies the simple straight line equation:

y = mx + b

where,

• x is the independent variable;
• y is the dependent variable;
• m is the slope (gradient) of the line;
• b is a constant, equal to the value of y when x = 0.

If there are multiple ranges of x-values, the line of best fit satisfies the following equation:

y = m1x1 + m2x2 + ... + b

where,

• the x's are the independent variable ranges;
• y is the dependent variable;
• the m's are constant multipliers for each x range;
• b is a constant.

LINEST function in Excel

The Excel LINEST function returns statistical information on the line of best fit, through a supplied set of x- and y- values.

The basic statistical information returned is the array of constants, mn, mn-1, ... , b for the equation:

y = m1x1 + m2x2 + ... + b

or, for a single range of x values, the function returns the constants m and b for the straight line equation:

y = mx + b.

Syntax :

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

Known_y's : array of known y-values.

Known_x's] : array of one or more sets of known x-values.

Const : constant 'b' is treated in the equation y = m1x1 + m2x2 + ... + b.

TRUE (or omitted) : constant b is treated normally;

FALSE : constant b is set to have the value 0.

Stats : An optional logical argument which specifies whether or not you want the function to return additional regression statistics on the line of best fit.

TRUE : returns additional regression statistics.

FALSE (or omitted) : Doesn't return additional regression statistics.

As the Linest function returns an array of values, it must be entered as an array formula. If the function is not entered as an array formula, only the first 'm' value in the calculated array of statistical information will be displayed in your spreadsheet.

You can see if a function has been input as an array formula, as curly brackets will be inserted around the formula, as it is viewed in the formula bar. This can be seen in the examples below.

Example :

All of these might be confusing to understand. Let's understand how to use the function using an example. Here Cells A2-A11, B2-B11 and C2-C11 of the spreadsheet below contain three different sets of independent variables (known x values), and cells D2-D11 of the spreadsheet contain the associated known y-values. Cells F1-H3 of the spreadsheet show the results of the Excel Linest function, which has been used to return statistical information relating to the line of best fit through these points.

As shown in the formula bar, the formula for the Linest function in this case is:

 =LINEST( D2:D11, A2:C11, TRUE, TRUE ) Once again, the curly brackets around the function show that it has been entered as an array formula.

Cells F1-I1 give the values of the coefficients, m3, m2 and m1 as 3.874869212, 2.027512015 and 4.049870099, respectively and the y-intercept, b as 5.710012148. Therefore, the equation for the line of best fit through the given points is:

y = 4.049870099 x1 + 2.027512015 x2 + 3.874869212 x3 + 5.710012148

The remaining cells in the range F1-I5 give the following additional statistics for this curve:

• The standard error values for the coefficients m3, m2 and m1are 2.135679853, 0.34376891 and 1.266886166, respectively
• The standard error value for the constant b is 7.317717472
• The coefficient of determination is 0.998527084
• The standard error for the y estimate is 1.534343593
• The F statistic is 1355.850961
• The number of degrees of freedom is 6
• The regression sum of squares is 9575.874738
• The residual sum of squares is 14.12526158

Here are all the observational notes using the formula in Excel
Notes :

1. The function returns #REF! Error, if the array of [known_x's] is not the same length as the array of known_y's.
2. The function returns #VALUE! Error Any of the values in the supplied [known_x's] or known_y's arrays are non-numeric (this may include text representations of numbers, as the Linest function does not recognise these as numeric values) Or Either the [const] or [stats] argument can not be evaluated to TRUE or FALSE.

Hope this article about How to use the LINEST function in Excel is explanatory. Find more articles on calculating values and related Excel formulas here. If you liked our blogs, share it with your friends on Facebook. And also you can follow us on Twitter and Facebook. We would love to hear from you, do let us know how we can improve, complement or innovate our work and make it better for you. Write to us at info@exceltip.com.

Related Articles :

How to use the VAR function in Excel : Calculate the variance for the sample dataset in excel using the VAR function in Excel.

How to Calculate Standard Deviation in Excel : To calculate the standard deviation we have different functions in Excel. The standard deviation is the square root of the variance value but It tells more about the dataset than variance.

Regressions Analysis in Excel : Regression is an Analysis Tool, which we use for analyzing large amounts of data and making forecasts and predictions in Microsoft Excel.

How To Use Excel T TEST Function in Excel : The T.TEST is used to determine the confidence of an analysis. Mathematically, it is used to know if the mean of the two samples are equal or not. T.TEST is used to accept or reject the null hypothesis.

How to use Excel F.TEST Function in Excel : The F.TEST Function is used to calculate F statistic of two samples in excel internally and returns the two tailed probability of the F statistic under Null Hypothesis.

Popular Articles :