Returns a table of statistics for a straight line that best fits a data set.
LINEST(yvalues, xvalues, allow_const, stats)
yvalues is a single row or column range specifying the y coordinates in a set of data points.
xvalues is a corresponding single row or column range specifying the x coordinates. If xvalues is omitted it defaults to 1, 2, 3, ..., n. If there is more than one set of variables xvalues may be a range with corresponding multiple rows or columns.
LINEST finds a straight line that best fits the data, using linear regression (the "least squares" method). With more than one set of variables the straight line is of the form .
if allow_const is FALSE the straight line found is forced to pass through the origin (the constant a is zero; ). If omitted, allow_const defaults to TRUE (the line is not forced through the origin).
to are the line gradients; a is the y-axis intercept.
to are the standard error values for the line gradients; is the standard error value for the y-axis intercept.
is the determination coefficient RSQ; is the standard error value for the y estimate.
F is the F statistic (F-observed value); df is the number of degrees of freedom.
is the regression sum of squares; is the residual sum of squares.
Example:
In the example above, cells A2:B8 contain the x,y values for a set of points. LINEST(B2:B8,A2:A8,1,1) returns the statistics for the best fit line through those points.
In the example above, you measure the floor area and count the windows of a sample of houses in the area, and make a table with the corresponding sale value (cells A2:C8). To predict the value of other houses in the area you might use: value = a + b1*floor_area + b22*num_windows, where a, b1 and b2 are constants. LINEST(A2:A8,B2:C8,1,1) returns appropriate statistics for that equation.
Predicting House Prices Based on Square Footage
Scenario:
You are a real estate analyst and you want to understand the relationship between the size of a house (in square feet) and its selling price. You've collected data on 10 recently sold houses in a particular neighborhood. You believe that there is a linear relationship between these two variables, and you want to use this data to predict the price of other houses in the same area.
Data Table:
Square Footage (X) | Selling Price (Y) | ||
|---|---|---|---|
A | B | ||
1 | 1200 | $320,000.00 | |
2 | 1500 | $390,000.00 | |
3 | 1350 | $360,000.00 | |
4 | 1800 | $450,000.00 | |
5 | 2100 | $520,000.00 | |
6 | 1650 | $410,000.00 | |
7 | 1950 | $490,000.00 | |
8 | 1400 | $370,000.00 | |
9 | 2200 | $540,000.00 | |
10 | 1750 | $430,000.00 |
Goal:
Use the LINEST function to find the slope (m) and the y-intercept (b) of the line of best fit, along with other statistical information that helps you evaluate the reliability of your model.
How to Use LINEST:
LINEST(B1:B10, A1:A10, TRUE, TRUE)
Results:
The LINEST function will populate the selected cells with the following output (approximately):
A | B | ||
|---|---|---|---|
1 | Slope (m) | Y-intercept (b) | |
2 | 175.76 | 114,142.42 | |
3 | Standard Error of Slope | Standard Error of Y-intercept | |
4 | 10.23 | 17,908.55 | |
5 | Coefficient of Determination (R2) | Standard Error for the Y Estimate | |
6 | 0.98 | 7,125.89 | |
7 | F-statistic | Degrees of Freedom | |
8 | 390.45 | 8 | |
9 | Regression Sum of Squares | Residual Sum of Squares | |
10 | 1.98E+10 | 4.07E+08 |
Interpretation:
Conclusion:
Using the LINEST function, you have successfully created a predictive model for house prices in this neighborhood. You can now use the equation y=175.76x+114,142.42 to estimate the price of a house if you know its square footage. For example, a house of 2000 square feet would be estimated to sell for:
175.76∗2000+114,142.42=351,520+114,142.42=$465,662.42
PRODUCT & FEATURES
RESOURCES
Terms | Privacy | Spam Policy
© 2026 Zapof