OLS in ExcelFast path

Week 8 · the same Summit Gear regression you fit in Python, done in a spreadsheet in a few minutes
Built-in AI tutor. Stuck on a formula or unsure how to read the output? Ask the helper on this page. It coaches the Excel mechanics and the interpretation, it does not hand you the answer.

Python is the spine for Week 8, but Excel can do this same work too. The same ordinary-least-squares fit takes only a couple of minutes in a spreadsheet, and it is worth knowing both routes. This page walks the fast path on the same Summit Gear customers data and the same targetdays_to_pay, how long a customer takes to pay an invoice. Two ways to fit it (the Data Analysis ToolPak first, then LINEST as the formula alternative), how to read the coefficients and R², and — the part that matters most — how to do feature selection and spot multicollinearity in Excel, with a correlation matrix, before you trust a single number.

1. The data 2. ToolPak 3. LINEST 4. Read it 5. CORREL matrix Takeaways
Step 1

The data sits in a sheet

Open summit_gear_customers.csv in Excel. Each row is one B2B customer; the column we want to forecast is days_to_pay. The predictors are the other numeric columns. Here are the first few rows laid out the way Excel sees them — row 1 is the header, so the data starts on row 2.

Download the data — summit_gear_customers.csv

2,200 rows, one per B2B customer. The final hosted raw-URL is wired at deploy; if the link above does not resolve on the preview host yet, the same file is published with the rest of the course data at deploy time.

Throughout this page, assume the predictors you will model on sit in columns F:M (credit_limit through avg_order_value) and the target days_to_pay sits in column P, with data on rows 2 through 2201 (2,200 customers). The exact letters depend on your column order — the formulas below use these as a concrete example.
Step 2

Fit it with the Data Analysis ToolPak — the path to start with

Reach for the Data Analysis ToolPak first. It runs the same ordinary-least-squares fit but hands you a labeled, readable output table — coefficients, standard errors, t-stats, p-values, and R², all named — from a four-click dialog:

  1. Data → Data Analysis → Regression. (Not there? File → Options → Add-ins → Manage Excel Add-ins → Go → check Analysis ToolPak.)
  2. Input Y Range: the days_to_pay column, header included (P1:P2201).
  3. Input X Range: the predictor columns, contiguous, header included (F1:M2201).
  4. Check Labels, pick an output cell, click OK.
The ToolPak needs the X columns to be contiguous (one solid block). If your predictors are scattered, copy them next to each other on a scratch sheet first. This is also the moment to decide which predictors go in — see Step 5.
Live-Excel check pending. The instructor will verify this dialog end-to-end once the CSV above downloads. The numbers in Step 4 are the real fit from the dataset; the four-click path is the part being confirmed.
Step 3

The formula alternative: LINEST

If you want the same fit live in a cell without opening a dialog, LINEST fits the whole regression in a single array formula. The arguments are the Y range (the target), the X range (the predictors), then two TRUE flags that say "yes, fit an intercept" and "yes, give me the full statistics block."

==LINEST(P2:P2201, F2:M2201, TRUE, TRUE)

In modern Excel this spills automatically — click one cell, type it, press Enter, and the output block fills in. In older Excel you select a block first (rows = number of stat lines, columns = number of predictors + 1), type the formula, then press Ctrl+Shift+Enter to enter it as an array.

Read it right-to-left and top-to-bottom. LINEST returns the coefficients in reverse column order (last predictor first), the intercept is the far-right value on the top row, and the statistics are unlabeled. That is why the ToolPak (Step 2) is the path to start with for a readable table. LINEST is the no-dialog way to get the same numbers live in a cell — same fit either way, pending the instructor's live-Excel check.
Step 4

Read the coefficients and R²

Both paths produce the same fit. This is the ToolPak-style output for the full "kitchen sink" model on Summit Gear — every numeric predictor thrown in at once. The numbers are the real fit from the dataset.

Fit summary

Multiple R0.919R Square0.844
Adjusted R Square0.843Observations2,200

R² = 0.844 means the model explains about 84% of the variation in how long customers take to pay. Adjusted R² (0.843) is R² with a penalty for the number of predictors — watch it, not plain R², when you add or drop columns.

Coefficients

TermCoefficientStd Errort StatP-value
Intercept23.4320.93025.190.000
credit_limit-0.000000.00003-0.110.915
avg_balance0.000780.000099.020.000
annual_spend0.000010.000001.760.079
prior_late_count3.3390.11130.040.000
days_since_last_order0.0260.0064.280.000
orders_per_year-0.1920.033-5.910.000
discount_rate-1.6960.077-22.060.000
avg_order_value0.000040.000041.030.303
noise_a0.0030.0100.300.767
noise_b0.0040.0050.760.448

Read a coefficient as: holding the other predictors fixed, a one-unit rise in this predictor changes predicted days_to_pay by this many days.

Two that clearly matter. prior_late_count = +3.34: each prior late payment adds about three and a third days to the predicted time-to-pay. discount_rate = -1.70: customers on deeper discounts pay a bit faster. Both have tiny p-values — the data is confident about them. The two noise columns sit near zero with large p-values: the model correctly finds nothing there.
Notice the three big-dollar columns — credit_limit, avg_balance, annual_spend — look weak and jumpy here (one is even slightly negative). That is not because they do not matter. It is multicollinearity, and Step 5 is how you catch it.
Step 5

Feature selection starts with a correlation matrix: =CORREL

Before trusting any coefficient, check whether your predictors are stepping on each other. The fast Excel way is a correlation matrix: =CORREL of each predictor pair. Build it by hand for a few suspect columns, or use Data Analysis → Correlation for the whole block at once.

==CORREL(F2:F2201, G2:G2201)

One pair at a time: this returns the correlation between two columns, a number from -1 to +1. Drag it across a grid of predictor-vs-predictor cells and you have the matrix below. These are the real Summit Gear correlations. The diagonal is always 1.00; the cells that matter are the off-diagonal ones — a hot off-diagonal cell, two predictors correlating near ±1, is the warning sign that they measure the same thing and the regression cannot separate their effects.

credit_
limit
avg_
balance
annual_
spend
prior_
late
discount_
rate
days_to
_pay
credit_limit1.000.980.960.110.010.84
avg_balance0.981.000.990.120.010.86
annual_spend0.960.991.000.110.010.85
prior_late_count0.110.120.111.000.010.35
discount_rate0.010.010.010.011.00-0.17
days_to_pay0.840.860.850.35-0.171.00
The red flags are the green block in the top-left corner. credit_limit, avg_balance, and annual_spend correlate with each other at 0.96 to 0.99. They are three measurements of essentially the same thing — how big a customer is. When predictors are that tightly linked, the regression cannot tell their individual effects apart, so it hands out unstable, jumpy coefficients (exactly what you saw in Step 4).
The clean predictors — prior_late_count, discount_rate — correlate near 0 with everything except the target. Those are the ones the model reads confidently.

The fix: keep one, drop the rest, then refit

The correlation matrix is the whole diagnostic here — no extra metric needed. The hot block in the top-left corner is the signal to act: pick one member of the cluster to represent customer size, drop the other two, and re-run the regression. Refitting with just avg_balance (cluster trimmed, noise columns removed) gives a stable coefficient that recovers the real relationship:

Term (pruned model)CoefficientStd Error
Intercept23.6290.519
avg_balance0.000900.00001
prior_late_count3.3320.111
days_since_last_order0.0260.006
orders_per_year-0.2120.022
discount_rate-1.6980.077
R² barely moved (0.844 → 0.844, adjusted 0.843 → 0.843) — you lost almost no explanatory power by dropping two of the three size columns, because they were redundant. But avg_balance now reads a clean, stable +0.00090 with a tiny standard error. That is the payoff of feature selection: fewer predictors, a more honest model, coefficients you can actually defend.

The fast Excel path, in one breath

This is the same logic as the Python feature-selection visualizer and the OLS trainer, in a spreadsheet. Python stays the spine for the lab and homework; Excel is the fast second lane when you want a fit and a sanity check in a couple of minutes.