Track
Excel has a great tool for linear regression called LINEST(). LINEST() is great because it calculates the statistics for a straight line that best fits your data using the least squares method. I also like LINEST() because it gives you additional model info, like the F-statistic and standard errors.
Keep reading and I'll show you all about LINEST() so you can use it for your trend analysis, forecasting, and more.
What Excel LINEST() Is Doing
Before we try examples, let me give a higher-level view of what LINEST() is doing.
LINEST() performs linear regression using the least squares method, which finds the line that minimizes the sum of squared residuals, which are the squared differences between the observed y-values and those predicted by the line. Under the hood, Excel's LINEST() uses matrix algebra to solve what is known as the normal equation that arises in ordinary least squares (OLS) regression.
Regression is one of the absolute most important things an analyst or data scientist needs to be skilled with. Regression is used for everything from comparing models and forecasting, to hypothesis testing and causal inference.
Syntax for Excel LINEST()
The syntax for LINEST() is as follows:
=LINEST(known_y's, [known_x's], [const], [stats])
-
known_y's: The dependent data values (required) -
known_x's: The independent data values (optional) -
const: Logical value;TRUEto calculate the intercept,FALSEto force it to zero (optional) -
stats: Logical value;TRUEto return additional regression statistics,FALSEfor only slope/intercept (optional)
Using Excel LINEST() for Regression
Let’s now look at both the simple linear regression case (one independent variable) and the multiple linear regression case (more than one independent variable).
LINEST() and simple linear regression
To perform a simple linear regression with one independent variable, you can use LINEST() with just your y-values and x-values. This best-fit line for simple linear regression is defined by exactly two parameters: its slope and intercept.
=LINEST(B2:B10, A2:A10, TRUE, TRUE)
By setting the optional arguments to TRUE, LINEST() returns several statistics, as you can see in the image below:
- Slope(s) for each independent variable
- Intercept
- Standard error values
- R-squared value
- F-statistic and degrees of freedom
By default, because LINEST() is an array formula, it will output a 2x5 grid (when doing simple linear regression with the stats argument as TRUE).
Personally, I like to wrap LINEST() inside of TOCOL() so I get the output as one column.
Just make sure that you keep the columns in the right order!
We have a great Introduction to Statistics course if you want additional help interpreting output like this.
LINEST() and multiple linear regression
LINEST() can also handle multiple independent variables for multiple regression analysis. Simply provide a range for known_x's that includes all your variables.
=LINEST(C2:C10, A2:B10, TRUE, TRUE)

This example calculates regression statistics for y-values in C2:C10 with two independent variables in columns A and B. A helpful tip is to keep a second grid so you can match up the statistics accurately.
For a video walk-through of how to use LINEST() and other functions, tune in to our Regression in Excel Made Easy YouTube video.
When You Will Use LINEST()
LINEST() is used for:
- Trend analysis in sales, finance, and scientific data
- Forecasting future values based on historical data
- Evaluating the strength of relationships between variables
- Building predictive models in Excel
Some Additional Tips
Some best practices to keep in mind are:
-
Always check your data for outliers before running regression. This is because
LINEST()using an OLS estimator which is sensitive to outliers. -
Use the
statsargument to get a full set of regression diagnostics -
Remember to enter
LINEST()as an array formula when you need all statistics -
Combine
LINEST()with graphs to tell a richer story.
Troubleshooting Excel LINEST() Errors
If you encounter errors with LINEST(), consider these ideas:
-
Mismatched ranges for
known_y'sandknown_x's -
Non-numeric data in your input ranges
-
Forgetting to enter the formula as an array when needed
Conclusion
As you have seen, you can use LINEST() for both simple and multiple linear regression in Excel, and, as you have also seen, LINEST() doesn’t just give you the two parameters (slope and intercept) but it also gives you additional model statistics if you choose to see them.
Keep learning with us. Take our Data Analysis in Excel course or our Data Analysis with Excel Power Tools skill track today.

I'm a data science writer and editor with contributions to research articles in scientific journals. I'm especially interested in linear algebra, statistics, R, and the like. I also play a fair amount of chess!