Why correlation comes before regression
Every business has a question of the form if we do more of X, do we get more of Y? More ad spend and more sales, more sales staff and more revenue, bigger stores and higher turnover, more discounts and more units sold. Regression analysis is the standard tool to answer such questions with numbers, and Excel can do all of it without add-ins. But every regression starts with a simpler step that many people skip: plotting the two variables and measuring how closely they move together. That is the topic of this free first lesson of Regression Analysis for Business in Excel.
This lesson is for analysts, controllers, marketing and sales people, students in business statistics and anyone who has been asked to "check whether there is a relationship". You need basic Excel: formulas, absolute references and inserting a chart. No statistics background is required, because you calculate the correlation coefficient by hand first and then confirm it with Excel's built-in function, so you understand what the number means instead of only reading it.
The example company is Oakhurst Home Stores, a fictional chain of 20 home-goods stores. You are its new analyst, and all 21 labs in the course use Oakhurst data. Marketing wants to know whether weeks with more local advertising are also weeks with higher sales. You have 15 weeks of data from store 07, weeks 27 to 41 of 2026, with ad spend and sales in thousands of dollars.
The core idea: a scatter plot and one number
A scatter plot puts one variable on the horizontal axis (x) and the other on the vertical axis (y), with one point per observation. If the points rise from left to right in a band, the variables move together. The narrower the band, the stronger the relationship. A scatter plot is the right chart whenever both variables are numbers, as opposed to a line chart, where the horizontal axis is usually time or a category.
The correlation coefficient r (Pearson's r) puts that picture into one number between −1 and +1. +1 means all points lie exactly on an upward straight line, −1 means all points lie exactly on a downward straight line, and 0 means there is no linear relationship at all. Values in between describe how tightly the points follow a line. There is no universal scale for "strong" or "weak"; as a rough guide, many business analysts treat values above about 0.7 in absolute terms as strong, but what counts as strong depends on the field and the data.
The formula looks intimidating but follows a simple logic. For each week, take the deviation of ad spend from its mean, (x − x̄), and the deviation of sales from its mean, (y − ȳ), and multiply them. If a week has above-average ad spend and above-average sales, both deviations are positive and the product is positive. If both are below average, both deviations are negative and the product is positive again. Only weeks where one is above and the other below average produce a negative product. Adding up all products therefore tells you whether the variables mostly move in the same direction.
The sum of products depends on the units: dollars times dollars, or thousands times thousands. To get a pure number between −1 and +1, divide it by the square root of the two sums of squared deviations:
r = Σ(x − x̄)(y − ȳ) / √( Σ(x − x̄)² × Σ(y − ȳ)² )
Excel's DEVSQ function returns each sum of squared deviations directly, so the hand calculation needs only a helper column for the products. CORREL and PEARSON return the same r in one step. Finally, r² is the share of the variation in y that moves together with x. You meet it again as the R² of a regression in the next lesson, where it measures how much of the variation in sales the regression line explains.
Worked example: 15 weeks at store 07
Here is the full lab data with the deviations and their products. The means are x̄ = 8.38 ($8,380 of ad spend per week) and ȳ = 109.05 ($109,050 of sales).
| Week | Ad spend x ($000) | Sales y ($000) | x − x̄ | y − ȳ | (x − x̄)(y − ȳ) |
|---|---|---|---|---|---|
| Week 27 | 6.1 | 87.2 | -2.28 | -21.85 | 49.81 |
| Week 28 | 4.2 | 83.5 | -4.18 | -25.55 | 106.79 |
| Week 29 | 8.3 | 100.0 | -0.08 | -9.05 | 0.72 |
| Week 30 | 7.0 | 108.3 | -1.38 | -0.75 | 1.03 |
| Week 31 | 10.8 | 131.2 | +2.42 | +22.15 | 53.61 |
| Week 32 | 5.5 | 90.2 | -2.88 | -18.85 | 54.28 |
| Week 33 | 9.4 | 118.7 | +1.02 | +9.65 | 9.85 |
| Week 34 | 12.0 | 130.8 | +3.62 | +21.75 | 78.75 |
| Week 35 | 6.8 | 107.8 | -1.58 | -1.25 | 1.97 |
| Week 36 | 11.5 | 123.6 | +3.12 | +14.55 | 45.41 |
| Week 37 | 5.0 | 79.7 | -3.38 | -29.35 | 99.19 |
| Week 38 | 8.9 | 112.5 | +0.52 | +3.45 | 1.80 |
| Week 39 | 12.6 | 134.5 | +4.22 | +25.45 | 107.41 |
| Week 40 | 7.6 | 105.9 | -0.78 | -3.15 | 2.45 |
| Week 41 | 10.0 | 121.8 | +1.62 | +12.75 | 20.66 |
| Mean / sum | 8.38 | 109.05 | 0 | 0 | 633.72 |
Look at the last column: every product is positive. No week has above-average ad spend together with below-average sales, or the other way round. The sum of products is 633.72. DEVSQ of ad spend is 97.844 and DEVSQ of sales is 4531.60, so
r = 633.72 / √(97.844 × 4531.60) = 633.72 / 665.88 = 0.9517
That is a very strong positive linear relationship. r² = 0.9058, so about 91% of the week-to-week variation in sales moves together with ad spend. The lab cells and formulas are:
| Cell | What it calculates | Formula | Result |
|---|---|---|---|
| D2 | Deviation product for week 27 | =(B2-AVERAGE($B$2:$B$16))*(C2-AVERAGE($C$2:$C$16)) | 49.81 |
| D9 | Deviation product for week 34 | =(B9-AVERAGE($B$2:$B$16))*(C9-AVERAGE($C$2:$C$16)) | 78.75 |
| (helper) | Sum of products | =SUM(D2:D16) | 633.72 |
| (helper) | Sum of squared deviations of x and y | =DEVSQ(B2:B16), =DEVSQ(C2:C16) | 97.844 and 4531.60 |
| B18 | r by hand | =SUM(D2:D16)/SQRT(DEVSQ(B2:B16)*DEVSQ(C2:C16)) | 0.9517 |
| B19 | r with the built-in function | =CORREL(B2:B16,C2:C16) | 0.9517 |
| B20 | r squared | =B19^2 | 90.6% |
The chart below shows the same calculation geometrically. The dashed lines are the two means and divide the chart into four quadrants. Points in the upper-right and lower-left quadrants have positive products, points in the other two quadrants would have negative products. All 15 weeks lie in the positive quadrants, which is exactly what a high r means.
Not every week contributes equally. Weeks far from both means, such as week 39 with the highest ad spend and highest sales, or week 28 with the lowest ad spend and low sales, have large products. Weeks close to the average, such as week 29, contribute almost nothing. This matters because a correlation can be driven by a few extreme observations. If one unusual week dominated the sum, a single data error could create or destroy a "relationship".
In the next lesson the same sums return. The slope of the regression line is the sum of products divided by DEVSQ of x, 633.72 / 97.844 = 6.477, and the intercept follows from the means. The trendline you add to your scatter chart in the lab has the equation y ≈ 6.48x + 54.77, which means, for example, that each additional $1,000 of ad spend goes together with about $6,477 more sales in this data. Whether that is a causal effect is a different question, discussed below.
Step by step: correlation and scatter chart in Excel
The steps below rebuild the lab in a normal Excel workbook. They are written for Excel 365 on Windows; Excel 2016 and later and Excel for Mac use the same functions and similar menus.
- Enter the data. Put week labels in A2:A16, ad spend in B2:B16 and sales in C2:C16, with headers in row 1. Keep x (the variable you think may drive the other) in the left column.
- Deviation products. In D2 type
=(B2-AVERAGE($B$2:$B$16))*(C2-AVERAGE($C$2:$C$16)). Press F4 while the cursor is on a range to add the $ signs. Copy D2 down to D16 with a double-click on the fill handle. - r by hand. In B18 type
=SUM(D2:D16)/SQRT(DEVSQ(B2:B16)*DEVSQ(C2:C16)). Without the helper column you can use=SUMPRODUCT((B2:B16-AVERAGE(B2:B16))*(C2:C16-AVERAGE(C2:C16)))/SQRT(DEVSQ(B2:B16)*DEVSQ(C2:C16)). - Check with CORREL. In B19 type
=CORREL(B2:B16,C2:C16). It must match B18 to many decimal places. - r squared. In B20 type
=B19^2and format as a percentage with Ctrl+Shift+%.=RSQ(C2:C16,B2:B16)gives the same value directly. - Insert the scatter chart. Select B1:C16 and choose Insert > Charts > Insert Scatter (X, Y) or Bubble Chart > Scatter. Excel uses the left column as x and the right column as y.
- Add the trendline. Click the chart, open Chart Elements (+) and tick Trendline. In More Options choose Linear and tick Display Equation on chart and Display R-squared value on chart.
- Label the chart. Under Chart Elements > Axis Titles add Ad spend ($000) for the horizontal axis and Sales ($000) for the vertical axis, and give the chart a title such as Sales vs ad spend.
- Look before you conclude. Check the chart for outliers, curves or separate groups of points before you report r.
What r cannot tell you
The correlation coefficient is useful but easy to misread. Two cautions matter most. First, r only measures straight-line relationships. A curve, two separate groups or one extreme outlier can produce a misleading r. The famous example is Anscombe's quartet: four data sets published by the statistician Francis Anscombe in 1973 with practically the same correlation and the same regression line, yet completely different scatter plots. The panels below make the same point with simpler shapes.
Second, correlation is not causation. A strong r says that ad spend and sales move together, not that the ads caused the sales. At Oakhurst, marketing may simply spend more in weeks that are busy anyway, for example before holidays or during a seasonal sale, so both numbers rise for a third reason. To get closer to a causal answer, you need more information: control variables in a multiple regression (lesson 5), dummy variables for seasons (lesson 6) or, best of all, a planned test where ad spend is changed on purpose in some stores and not in others.

Common mistakes and how to spot them
- Forgetting the $ signs. Without absolute references, the mean range shifts as you copy the formula down, and the deviations are wrong. Spot it by checking that the deviations in each column add up to zero.
- Subtracting the wrong mean. Using the mean of x for the sales deviation gives large products that do not mean anything. Each variable must be compared with its own mean.
- Forgetting the square root. Dividing by DEVSQ(x) × DEVSQ(y) instead of its square root gives a tiny number. Any r between about −0.01 and 0.01 when the chart shows a clear pattern is a warning sign.
- Reporting the covariance as r.
COVARIANCE.Sdepends on units and is not limited to −1 to +1. If your "correlation" is 45, it is a covariance. - Confusing r and r².
RSQreturns r². r = 0.95 means r² ≈ 0.91. Always say which one you report. - Using a line chart instead of a scatter. A line chart treats x as categories in table order and spaces them evenly. If your x axis shows 1, 2, 3… instead of the ad spend values, you inserted the wrong chart type.
- Trusting r without looking. One outlier or a curve can make r high or low for the wrong reason. Always check the scatter plot.
- Calling it causation. If your sentence contains "because", "drives" or "causes", ask what else could move both variables.
Quick reference: functions and shortcuts used
All functions and shortcuts from this lesson.
| Function / shortcut | What it does here | Example |
|---|---|---|
AVERAGE | Mean of x or y | =AVERAGE($B$2:$B$16) |
DEVSQ | Sum of squared deviations from the mean | =DEVSQ(B2:B16) |
SUMPRODUCT | Sum of products of deviations in one formula | =SUMPRODUCT((B2:B16-AVERAGE(B2:B16))*(C2:C16-AVERAGE(C2:C16))) |
SQRT | Square root | =SQRT(DEVSQ(B2:B16)*DEVSQ(C2:C16)) |
CORREL / PEARSON | Correlation coefficient r | =CORREL(B2:B16,C2:C16) |
RSQ | r squared directly (y range first) | =RSQ(C2:C16,B2:B16) |
COVARIANCE.S | Sample covariance (depends on units) | =COVARIANCE.S(B2:B16,C2:C16) |
| F4 | Toggles absolute references such as $B$2:$B$16 while editing | Lock the mean ranges |
| Insert > Charts > Scatter | XY scatter chart of two numeric columns | Select B1:C16 first |
| Chart Elements (+) > Trendline | Adds a linear trendline; More Options shows equation and R² | Display R-squared value on chart |
Real-world uses
- Marketing. Check whether weekly spend in a channel moves with leads, visits or sales before you build a budget model on it, and look for weeks that do not fit.
- Retail and store planning. Compare store size, foot traffic or local population with revenue across stores. The next lessons turn exactly such relationships into forecasts for new locations.
- Finance and controlling. Find out which cost drivers move with which costs, for example machine hours and maintenance costs, as a first step in cost estimation.
- Operations and HR. Look at the relationship between staffing levels and service times, or between training hours and error rates.
- Investing and risk. Correlations between the returns of assets are a basic input for diversification analysis, although they can change over time.
What you will build in the rest of this course
Lesson 1 is free. The remaining 20 lessons are part of the paid course ($9.90 one-time). Each one has an interactive lab with Oakhurst data and a Coach that checks your formulas step by step, so you build every statistic yourself before you use Excel's shortcuts.
Simple Linear Regression by Hand: Least Squares, R² & Standard Error. You fit sales = b0 + b1 × store size with nothing but sums of squares, measure the fit with R² and the standard error, and compare your results with SLOPE, INTERCEPT and STEYX. The sums from this lesson become the regression line.
Is the Slope Real? t Statistic, p-Value & Confidence Interval. You test whether email volume really drives online orders: standard error of the slope, t statistic, two-tailed p-value and a 95% confidence interval. This is where a relationship becomes a statement you can defend.
Predicting a New Store: Point Forecast & Prediction Interval. You forecast monthly sales for two planned stores and put a 95% prediction interval around each forecast, and you see why the interval widens away from the average store.
Multiple Regression with LINEST: Three Drivers at Once. You fit sales on foot traffic, local ads and competitors with LINEST, read each coefficient with INDEX, check R² and forecast a new site.
Dummy Variables: Regions and Seasons in a Regression. You turn text categories into 0/1 variables, fit them with LINEST, read the region effect against the base region and forecast a store in peak season. It is the standard way to control for seasons, as discussed above.
Residual Analysis: Residual Plot, Standardised Residuals & Outliers. You check a warehouse labour model the way a careful analyst does: residuals, standardised residuals, an outlier count and a residual plot.
Log Models & Elasticity, plus Two Classic Pitfalls. You fit a log-log demand model to read the price elasticity directly, check two predictors for multicollinearity with a correlation matrix and flag an extrapolation before anyone trusts the forecast.
Summary
Before you run any regression, plot the data and measure the correlation. r is the sum of the deviation products divided by the square root of the two sums of squared deviations, and CORREL gives the same number in one step. For Oakhurst store 07, r = 0.952 and r² = 90.6%: weeks with more ad spend are clearly weeks with more sales. Whether the ads caused the sales is a question the scatter plot alone cannot answer, and the rest of the course gives you the tools to investigate it.
Now scroll up and do the lab: fill the deviation products in column D, calculate r by hand and with CORREL, and insert the scatter chart with a linear trendline and both axis titles. The Coach checks every step and explains common slips such as a missing square root.
Frequently asked questions
How do I calculate the correlation coefficient in Excel?
Use =CORREL(x_range, y_range), for example =CORREL(B2:B16,C2:C16). PEARSON gives the same result, and the order of the two ranges does not matter.
What is a good correlation coefficient?
r ranges from -1 to +1. Values close to either end mean a strong linear relationship, values near 0 a weak one. What counts as strong depends on the field, so always look at the scatter plot as well.
What is the difference between r and R squared?
r is the correlation coefficient with a sign that shows the direction. r squared is the share of the variation in y that moves together with x. In simple linear regression, R squared equals r squared.
How do I add a trendline and R squared to a scatter plot in Excel?
Click the chart, open Chart Elements (+), tick Trendline, then choose More Options, select Linear and tick Display R-squared value on chart. You can also display the equation there.
Does correlation mean causation?
No. A strong correlation shows that two variables move together, but a third factor such as season may drive both. Controlled tests or regression with control variables help get closer to causal answers.
Should I use a line chart or a scatter chart for two numeric variables?
Use an XY scatter chart. A line chart treats the x values as evenly spaced categories in table order, which distorts the relationship.
Keep going: Regression Analysis for Business in Excel
This free lab is lesson 1 of 21. Unlock the other 20 hands-on labs, the final exam and your certificate for a one-time $9.90.
- Simple Linear Regression by Hand: Least Squares, R² & Standard Error
- Is the Slope Real? t Statistic, p-Value & Confidence Interval
- Predicting a New Store: Point Forecast & Prediction Interval
- Multiple Regression with LINEST: Three Drivers at Once
- Dummy Variables: Regions and Seasons in a Regression
- Residual Analysis: Residual Plot, Standardised Residuals & Outliers
- Log Models & Elasticity, plus Two Classic Pitfalls
- The ANOVA Table & the Overall F-Test: Does the Model Explain Anything?
- Do Extra Drivers Help? Comparing Nested Models with the Partial F-Test
- Choosing Between Models: Adjusted R², AIC & a Hold-Out Test
- Which Driver Matters Most? Standardised Coefficients & Elasticities at the Mean
- Multicollinearity in Numbers: Variance Inflation Factors & a Leaner Model
- Curved Relationships: Quadratic Terms & the Best Discount Depth
- Interaction Terms: When the Ad Effect Depends on the Location
- Influential Points: Leverage & Cook's Distance
- Funnel-Shaped Errors: Spotting & Testing Heteroscedasticity
- Residuals Over Time: Durbin–Watson & Autocorrelated Errors
- Did the Relationship Change? A Chow Test Before & After a Loyalty Programme
- Splitting Costs into Fixed & Variable: Regression vs the High–Low Method
- Capstone Project: Site-Selection Model & Dashboard