The LINEST function in Excel is a powerful tool for performing linear regression analysis. By applying this function, users can derive insights from data sets, identifying trends and predicting future outcomes based on linear relationships. This function is essential for data analysts, statisticians, and anyone needing to interpret quantitative data effectively.
Syntax
LINEST(known_y's, [known_x's], [const], [stats])
- known_y’s: This array or range represents the dependent variable data that you want to analyze.
- known_x’s: This optional array or range represents the independent variable data that explains the values in known_y’s.
- const: A logical value that indicates whether to force the intercept to be zero. If TRUE or omitted, it will calculate the intercept. If FALSE, it sets the intercept to zero.
- stats: A logical value indicating whether to return additional regression statistics. If TRUE, the function returns these stats; if FALSE or omitted, only the coefficients are returned.
Example #1
=LINEST(B2:B10, A2:A10)
This function calculates the slope and intercept of the linear relationship between the dependent variable in cells B2 to B10 and the independent variable in cells A2 to A10, providing a regression output. Result example: {2.5, 10} represents a slope of 2.5 and an intercept of 10.
Example #2
=LINEST(B2:B10, A2:A10, TRUE, TRUE)
Here, the function performs a regression analysis while calculating the y-intercept and returning additional statistical data. Result example: {2.5, 10; 0.5, 0.1; …} includes the slope, intercept, and statistical details such as R-squared and standard errors.
Example #3
=LINEST(B2:B10, A2:A10, FALSE)
This variant forces the intercept to zero, returning only the slope coefficient for the linear fit. Result example: {2.5} representing a slope of 2.5 with an intercept of zero.
Error handling
- VALUE!: Occurs when the arrays supplied are not of the same size or are improperly formatted.
- N/A: Indicates that LINEST could not compute the coefficients, often due to insufficient data points.
- NUM!: Happens when input data does not allow for regression computation, which can be the result of empty ranges.