How to Use the LINEST Function in Microsoft Excel for Multiple Linear Regression Analysis

In quantitative finance, business analytics, and scientific research, analysts frequently need to determine how multiple independent predictor variables influence a single dependent outcome. While Excel’s simple SLOPE and INTERCEPT functions work well for basic single-variable models, multivariate problems require multiple linear regression. The LINEST (Linear Estimation) function is Excel’s premier array formula for statistical regression, calculating slope coefficients, standard errors, coefficient of determination (R²), F-statistics, and residual sums of squares in a single operation.

Understanding the Syntax of the LINEST Function

The LINEST function fits a straight line (or hyper-plane) through data points using the least-squares method. The syntax is structured as follows:

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

Parameter Definitions

  • known_y's (Required): The range of cells containing the dependent variable data (e.g. quarterly revenue or temperature readings).
  • known_x's (Optional): The range of cells containing one or more independent variables (e.g. ad spend, headcount, interest rate). If omitted, Excel assumes an index array {1, 2, 3...} matching the size of known_y's.
  • const (Optional): A logical value specifying whether to force the constant intercept b to equal zero (FALSE) or calculate it normally (TRUE or omitted).
  • stats (Optional): A logical flag. If set to TRUE, LINEST returns an extended 5-row by k-column matrix of regression statistics. If set to FALSE or omitted, it returns only the regression slope coefficients and intercept.

Interpreting the Output Matrix of LINEST

When you set stats to TRUE, LINEST outputs a structured rectangular array. For a model with two independent predictor variables ($x_1$ and $x_2$), the 5-row statistical matrix is mapped as follows:

Row Column 1 Column 2 Column 3
Row 1 Slope coefficient ($m_2$) Slope coefficient ($m_1$) Intercept ($b$)
Row 2 Standard error ($se_2$) Standard error ($se_1$) Standard error of intercept ($se_b$)
Row 3 Coefficient of determination ($R^2$) Standard error of regression ($s_e$) N/A
Row 4 F-observed statistic ($F$) Degrees of freedom ($df$) N/A
Row 5 Regression sum of squares ($SS_{reg}$) Residual sum of squares ($SS_{resid}$) N/A

Note: Excel returns slope coefficients in reverse order of the columns entered in known_x's. If column 1 is Advertising and column 2 is Headcount, the first column of the output displays the coefficient for Headcount, followed by Advertising, and finally the constant intercept.

Step 1: Set Up Your Regression Dataset

Organise your data into clean columns without empty rows or text strings in numerical fields. For example:

  • Column A (A2:A25): Sales Revenue (known_y's)
  • Column B (B2:B25): Marketing Spend ($x_1$)
  • Column C (C2:C25): Store Footfall ($x_2$)

Step 2: Calculate Slope Coefficients and Intercept

In modern Excel (Microsoft 365 and Excel 2021), dynamic arrays spill results automatically into adjacent cells. To obtain just the coefficients:

  1. Click into an empty cell (such as E2).
  2. Enter the basic formula:
    =LINEST(A2:A25, B2:C25, TRUE, FALSE)
  3. Press Enter.

Excel spills three horizontal values: m2 (Store Footfall slope), m1 (Marketing Spend slope), and b (Y-intercept).

Step 3: Extract the Complete Statistical Array

To inspect statistical validity, goodness of fit, and regression significance, request the complete statistical table:

=LINEST(A2:A25, B2:C25, TRUE, TRUE)

Excel populates a 5-row by 3-column array spanning cells E2:G6. You can interpret the key metrics as follows:

  • R² (Cell E4): Indicates the proportion of total variance explained by the model. An R² of 0.88 signifies that 88% of sales variance is explained by marketing spend and footfall.
  • F-Statistic (Cell E5): Used to evaluate whether the overall regression model is statistically significant compared to a model with zero predictors.
  • Degrees of Freedom (Cell F5): Equal to $n – k – 1$, where $n$ is total observations and $k$ is the number of independent variables ($24 – 2 – 1 = 21$).
  • Residual Sum of Squares (Cell F6): Quantifies unexplained error in the sample.

Step 4: Extract Individual Metrics Using INDEX

If you need to incorporate specific metrics (such as R² or standard error) into dedicated summary dashboard cards without spilling the full array, wrap LINEST inside the INDEX function:

Extract R² (Goodness of Fit)

=INDEX(LINEST(A2:A25, B2:C25, TRUE, TRUE), 3, 1)

Extract the F-Statistic

=INDEX(LINEST(A2:A25, B2:C25, TRUE, TRUE), 4, 1)

Extract the Standard Error of the Regression

=INDEX(LINEST(A2:A25, B2:C25, TRUE, TRUE), 3, 2)

Legacy Excel Instructions (Excel 2019 and Earlier)

In older versions of Excel that lack dynamic array spill behavior, you must enter LINEST as a legacy CSE array formula:

  1. Select an exact range of empty cells measuring 5 rows down by 3 columns across (e.g. E2:G6).
  2. Type =LINEST(A2:A25, B2:C25, TRUE, TRUE) into the formula bar.
  3. Press Ctrl + Shift + Enter simultaneously. Curly braces {...} will enclose the formula, populating all 15 cells together.

Troubleshooting LINEST Errors and Multicollinearity

If LINEST returns a #VALUE! error, verify that known_y's and known_x's span identical row counts and contain strictly numerical values. If one of the slope coefficients returns 0 or #N/A while others calculate properly, your independent variables likely suffer from severe multicollinearity (one predictor variable is an exact linear multiple of another). Removing redundant, correlated predictors resolves the issue and restores robust statistical estimates.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.