Skip to the content

Topics Covered

Pearson Correlation Covariance Spearman Rank Correlation Matrix Linear Regression SLOPE / INTERCEPT FORECAST.LINEAR TREND
On this page
  1. 1. Correlation Analysis
  2. 2. Simple Linear Regression
  3. 3. Forecasting Functions
  4. Adding a Trendline to a Chart
  5. Best Practices for Regression Reporting
  6. Key Take-aways

1. Correlation Analysis

1.1 Pearson Correlation Coefficient

=CORREL(array1, array2)

Returns Karl Pearson's correlation coefficient \(r\), between −1 and +1.

Equivalent: =PEARSON(array1, array2) — same result.

EXAMPLE 1

Hours of study in A2:A11, marks in B2:B11. =CORREL(A2:A11, B2:B11) might return 0.92 — strong positive correlation.

EXAMPLE 2

Price (column A) and demand (column B) for 20 weeks: =CORREL(A2:A21, B2:B21) might return −0.84 — strong negative correlation.

1.2 Covariance

FunctionDivisorUse
=COVARIANCE.P(array1, array2)nPopulation covariance
=COVARIANCE.S(array1, array2)n − 1Sample covariance (unbiased)

Recall: \(r = \text{Cov}(X, Y) / (\sigma_X \sigma_Y)\). Cov is in original units; r is unit-free.

1.3 Spearman Rank Correlation

Excel has no direct Spearman function. Combine RANK.AVG with CORREL:

  1. Suppose data in A2:A11 and B2:B11.
  2. In C2 enter =RANK.AVG(A2, $A$2:$A$11, 1) and drag down — ranks of X (ties get average rank).
  3. In D2 enter =RANK.AVG(B2, $B$2:$B$11, 1) and drag down — ranks of Y.
  4. In another cell: =CORREL(C2:C11, D2:D11) — this is Spearman's \(\rho\).
EXAMPLE 1

Marks of Judge A: 90, 85, 70, 60, 95 (A2:A6); Judge B: 88, 80, 75, 65, 92 (B2:B6). Compute ranks (descending or ascending — order is consistent): both give ranks 4, 3, 2, 1, 5. Then =CORREL(ranksA, ranksB) gives ρ = 1.0 — the two judges rank the five candidates in exactly the same order, so rank agreement is perfect (\(\sum d^2 = 0\)).

EXAMPLE 2

Useful when data are ordinal (rankings) or have outliers — Spearman is less sensitive than Pearson.

1.4 Correlation Matrix (Multiple Variables)

Use Data Analysis ToolPak → Correlation:

  1. Data → Data Analysis → Correlation.
  2. Input Range: select all variables (multi-column block).
  3. Grouped by: Columns; tick "Labels in first row" if applicable.
  4. Output: choose location. Click OK.
  5. Excel produces a symmetric lower-triangular matrix of pairwise correlations.
EXAMPLE

For variables Height (A), Weight (B), Age (C): ToolPak produces:

HeightWeightAge
Height1
Weight0.851
Age0.400.321

2. Simple Linear Regression

2.1 Quick Coefficients via Worksheet Functions

FunctionReturns
=SLOPE(y_range, x_range)Slope b of the regression line Y = a + bX
=INTERCEPT(y_range, x_range)Intercept a
=RSQ(y_range, x_range)R² (coefficient of determination)
=STEYX(y_range, x_range)Standard error of the estimate
=FORECAST.LINEAR(x, known_y, known_x)Predicted Y for a given X
EXAMPLE 1

Study hours (A2:A11) and marks (B2:B11).

EXAMPLE 2

Sales (Y) vs advertising spend (X). Once SLOPE and INTERCEPT are computed, fitted line is \( \hat Y = a + bX \). Use FORECAST.LINEAR to predict sales for a planned advertising budget.

2.2 Regression via Data Analysis ToolPak

For a full regression report (ANOVA, t-statistics, R², p-values, confidence intervals):

  1. Data → Data Analysis → Regression → OK.
  2. Input Y Range: the dependent variable column (with header if you tick "Labels").
  3. Input X Range: the independent variable column(s). Up to 16 X variables in one regression.
  4. Tick Labels if first row contains headers.
  5. Tick Confidence Level (default 95 %).
  6. Choose output location and tick:
    • Residuals — table of fitted Y, residuals.
    • Standardized Residuals — z-scores of residuals.
    • Residual Plots — plot residual vs each X.
    • Line Fit Plots — observed Y & fitted Y vs X.
    • Normal Probability Plots — to check residual normality.
  7. Click OK.

Output Sections

EXAMPLE

Output from regression of marks on study hours:

StatisticValue
Multiple R0.920
R Square0.846
Adjusted R²0.827
Std. Error4.62
Observations10
Coeff.Std. Errtp-value
Intercept32.004.507.110.0001
Study hours7.501.126.700.0002

p-value of slope < 0.05 ⇒ study hours significantly predict marks.

3. Forecasting Functions

3.1 FORECAST.LINEAR

=FORECAST.LINEAR(x_new, known_y, known_x)

Returns the predicted Y for a single new X assuming a linear model fitted to historical (known_x, known_y).

3.2 TREND (array)

=TREND(known_y, known_x, new_x, [const])

Returns predicted Y values for multiple new_x values simultaneously (array formula in legacy Excel; spills in 365).

3.3 LINEST (multiple regression)

=LINEST(known_y, known_x, [const], [stats]) returns an array of regression coefficients (and optional statistics). Useful for multivariate regression in cells.

3.4 GROWTH (exponential trend)

=GROWTH(known_y, known_x, new_x, [const]) fits \(Y = a \cdot b^X\) and predicts.

3.5 FORECAST.ETS (Exponential Smoothing for Time Series, Excel 2016+)

=FORECAST.ETS(target_date, values, timeline, [seasonality], [data_completion], [aggregation]) applies Holt–Winters triple-exponential smoothing for seasonal time series.

Excel also has a Forecast Sheet tool (Data → Forecast → Forecast Sheet) that automatically builds a chart and table with confidence intervals.

EXAMPLE 1

Months 1–12 sales in A2:A13, B2:B13. To predict month 15: =FORECAST.LINEAR(15, B2:B13, A2:A13). For months 13–18 at once: select B14:B19 and enter {=TREND(B2:B13, A2:A13, A14:A19)} as array formula (or just =TREND(...) in Excel 365).

EXAMPLE 2

Quarterly revenue 8 quarters → predict next 4 using Forecast Sheet: select data → Data → Forecast Sheet → set forecast end → Create. Excel auto-fits ETS and shows lower/upper 95 % CI.

Adding a Trendline to a Chart

  1. Build a scatter chart of X vs Y.
  2. Right-click any data point → Add Trendline.
  3. Choose trendline type: Linear, Polynomial (order 2, 3, …), Exponential, Logarithmic, Power, Moving Average.
  4. Tick Display Equation on chart and Display R² value on chart.

The on-chart equation gives you a sanity check on SLOPE and INTERCEPT.

Best Practices for Regression Reporting

Key Take-aways