Table of Contents
The Method of Least Squares is a statistical technique used to find the best fitting line or curve for a set of data points. It is commonly used in regression analysis to determine the relationship between two variables. In Excel, this method can be applied by using the built-in function “LINEST”. This function calculates the slope and intercept of the best fitting line and also provides other statistical measures such as the coefficient of determination. By inputting the data points into a table and using the LINEST function, Excel can quickly and accurately calculate the best fitting line, making it a useful tool for data analysis and prediction.
Use Method of Least Squares in Excel
The method of least squares is a method we can use to find the regression line that best fits a given dataset.
The following video provides a brief explanation of this method:
To use the method of least squares to fit a regression line in Excel, we can use the =LINEST() function.
The following step-by-step example shows how to use this function in practice.
Step 1: Create the Dataset
First, let’s create the following dataset in Excel:

Step 2: Use Method of Least Squares to Fit Regression Line
We can use the =LINEST(known_ys, known_xs) function to use the method of least squares to fit a regression line to this dataset:

Once we press ENTER, the coefficients of the regression model will appear:

Step 3: Interpret the Results
Using the coefficients from the =LINEST() function, we can write the following fitted regression line:
y = 11.55211 + 1.07949(x)
We can use this equation to estimate the value of y based on the value of x.
y = 11.55211 + 1.07949(10) = 22.347
Step 4: Plot the Results
Lastly, we can use the following steps to plot the dataset along with the fitted regression line:
- Highlight cells A2:B16.
- Click the Insert tab along the top ribbon. Then click the first chart option titled Insert Scatter (X, Y) or Bubble Chart in the Charts group.
- Once the chart appears, click the plus “+” sign in the top right corner. In the dropdown menu, click the checkbox next to Trendline to add the fitted regression line to the chart.

Cite this article
stats writer (2024). How can I use the Method of Least Squares in Excel?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-use-the-method-of-least-squares-in-excel/
stats writer. "How can I use the Method of Least Squares in Excel?." PSYCHOLOGICAL SCALES, 2 May. 2024, https://scales.arabpsychology.com/stats/how-can-i-use-the-method-of-least-squares-in-excel/.
stats writer. "How can I use the Method of Least Squares in Excel?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-use-the-method-of-least-squares-in-excel/.
stats writer (2024) 'How can I use the Method of Least Squares in Excel?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-use-the-method-of-least-squares-in-excel/.
[1] stats writer, "How can I use the Method of Least Squares in Excel?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, May, 2024.
stats writer. How can I use the Method of Least Squares in Excel?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.
