UPI Study › Courses › Marketing Research › Free lessons › Lesson 12.3 Free lesson
How to Build a Correlation Matrix in Excel
Marketing Research · Chapter 12: Correlation, Regression, and Advanced Data AnalysisSection 12.3 · lesson 86 of 10111 min · free to watch
Lesson complete
Earn the 3 college credits for Marketing Research
Enrolling adds a quiz after each lesson, the graded work and the official transcript. Recommended for credit by NCCRS.
Next lesson: Using Regression Analysis to Predict Business Outcomes →← Coefficient of Determination (R²): What It Tells You About Your DataNext lesson: Using Regression Analysis to Predict Business Outcomes →
In this lesson
Build and read a correlation matrix with CORREL and the ToolPak.
- Compute a single correlation in Excel with the CORREL function
- Build a full correlation matrix by hand or with the Data Analysis ToolPak
- Turn on the Analysis ToolPak add-in through File, Options, Add-ins
- Read a matrix using the diagonal, the mirror halves and the outcome row
Free study notes
Get this lesson's notes by email
The key points and 4 practice questions with answers, in your inbox. One email, free.
One email. Unsubscribe in one click.
Transcript
Everything said in the video, section by section (1,540 words). Read along, or search it.
Opening Problem
Four Variables Mean Six Pairs
Leo has a long list of things that might lift sales of Fernway bars. A lower price. A bigger ad budget. A better shelf spot. Fernway Snacks is a composite case built for teaching.
Grace can compute one correlation by hand, as in lesson 12.1. But Leo's list has four variables. And four variables means six pairs. Nobody wants to do six calculations by pencil.
So here is the solution. A correlation matrix puts all the pairs in one table. And Excel can build it in a couple of minutes. Two different ways.
By the end of this lesson, you will compute one correlation in Excel. Then check the result against Python. You will build a full matrix with the Data Analysis ToolPak, including turning the add-in on. And you will read a matrix. The diagonal of ones. The mirror-image halves. And which pair is strongest.
Prior Knowledge
Building on Correlation and R Squared
The meaning of the correlation coefficient was covered in lesson 12.1. And r squared was in lesson 12.2. Setting up and recoding columns in Excel came in lessons 8.7 and 9.1.
Data Setup
Tidy Data and the CORREL Function
First: set up the data, and try one pair. As with every Excel analysis, start with a tidy list. One row per store. One column per variable. A clear heading on top. And numbers only in the data cells.
Grace's sheet looks like this. Store names in column A. Price in column B. Ad spend in column C. Shelf space in column D. And sales in column E. There are ten stores, in rows 2 to 11.
The units differ. Price is in dollars. Ad spend is in thousands of dollars. Shelf space is in feet. And weekly sales are in hundreds of bars. That does not matter for correlation. As you saw in lesson 12.1, r scales itself to fit between minus one and plus one, whatever the units.
The function is CORREL. It takes two ranges of the same size. And it returns Pearson's r between them.
Worked Example
Ad Spend and Sales Give 0.76
To correlate ad spend with sales, Grace types the formula in cell G2. Enter the ad spend range first: C2 to C11. Then a comma. Then the sales range, E2 to E11. And the result is 0.7646.
A few details matter. The order of the two ranges does not matter. Swapping them gives the same answer. The practice code checks this. But both ranges must be the same length. And text in the middle of a range is skipped, or causes an error. So check for stray words first.
What does the result mean? Ad spend and sales have r equals +0.76, across these ten stores. Stores with bigger ad budgets tended to sell more. That agrees with lesson 12.1. But this is one pair, out of six. Five pairs are still to go.
Matrix by Hand
Sixteen Cells but Six Pairs
Next: building the matrix by hand. A correlation matrix is a square table. The same variables run down the side, and across the top. Each cell holds the correlation of the row variable with the column variable.
With four variables, there are 4 times 4 cells. That is 16. But there are only 6 different pairs. Why? Because every pair appears twice. Price with ad spend. And ad spend with price. Plus the four cells where a variable meets itself.
In each cell, enter a CORREL formula with the right ranges. For example, compare price and ad spend. Use B2 to B11 for price, and C2 to C11 for ad spend. That works for small tables. For larger ones, there is a shortcut.
Here is the pro tip. Put the names down the side, in G2 to G5. And across the top, in H1 to K1. Then type one long formula in H2. And copy it across, and down.
Formula Shortcut
INDEX with ROW and COLUMN
How does it work? INDEX, with a zero for the row number, returns a whole column of the data. ROW and COLUMN pick which column. So each cell finds its own two variables, from its position in the table. And because this is a matrix of formulas, it updates by itself when the data change.
ToolPak Setup
Turning on the Analysis ToolPak
Next: the Data Analysis ToolPak, step by step. The Analysis ToolPak is an add-in. It comes with Excel. But it may be switched off. When it is on, it gives you a Data Analysis button, on the Data tab.
Here is how. Choose File. Then Options. Then Add-ins. In the Manage box, pick Excel Add-ins, and click Go. On a Mac, the add-ins command sits in the Tools menu instead.
Then tick Analysis ToolPak, and click OK. A Data Analysis button now appears at the right end of the Data tab. You only need to do this once.
Now run it. Click Data Analysis. Choose Correlation in the list. And click OK. A dialog box opens.
For the input range, select B1 to E11. Include the headings. The box then shows the range with dollar signs, B1 to E11. And leave out column A. The store names there are text.
Running the Tool
Correlation Output Fills the Lower Half
Leave Grouped By set to Columns, because each variable is a column. Tick Labels in first row. Under Output options, choose Output Range. Click a free cell, such as G1. Then click OK. Excel may phrase this window a little differently across versions. But the choices are the same.
What appears? A table, starting at G1. And only the lower left half of it is filled. Why? Because the upper right half would just repeat it. The cells on the diagonal hold ones.
Look at cell H4. It holds -0.3034. That is the correlation of shelf with price. Each number sits where its row and its column meet.
But there is one big difference between the two routes. The ToolPak writes a table, not formulas. Fix a typo in the data, and the table keeps the old numbers, until you run the tool again. Live formulas update on their own.
Common Mistake
Text Columns and Mismatched Labels
Here is a common mistake. Someone selects a range that includes the Store column. Names such as S1 and S2 are labels, not numbers. They cannot be used in a correlation. Or the labels box does not match the range. Ticked without headings, it eats a row of real numbers. Left empty with headings, it mixes words into the data. That mix-up quietly spoils the table.
So always select the headings, and the numbers only. And tick the box that matches. A ten-second check saves a confusing error message.
Reading the Matrix
Diagonal Ones and Mirror Halves
Next: reading the matrix. Three facts make any matrix quick to read.
First, the diagonal is all ones. A variable always correlates perfectly with itself. Price with price is one. Sales with sales is one. Those cells carry no news.
Second, the two halves are mirror images. Ad spend with sales equals sales with ad spend. Both are 0.76. That is why the ToolPak fills in only the lower left half.
Third, look at the row, or column, of the outcome you care about. Here, that is sales. Ad spend, +0.76. Shelf, +0.59. Price, -0.48.
Shade the cells by strength, and the picture gets even clearer. Cells of 0.7 or more are dark. Cells from 0.4 to under 0.7 are lighter. Below 0.4, lighter still. Those cut points are only a guide. And the signs tell direction. Price and sales move in opposite ways.
Interpretation
Ad Spend and Shelf Space Overlap
What does it mean for Leo? Across these ten stores, ad spend goes with sales most closely. Shelf space comes second. And higher prices go with lower sales.
The matrix also shows something hidden. Ad spend and shelf space have r equals +0.33. So stores with big ad budgets also tended to have more shelf space. When predictors overlap like that, it is hard to say which one does the work.
That is exactly the problem that multiple regression, in lesson 12.4, is designed to handle. And, as in lesson 12.1, none of these numbers proves a cause. With only ten stores, one odd store can move a correlation a lot.
Back at the office, Grace sends Nadia the ToolPak table. Nadia notices that price has a negative number in the sales row. "So lowering the price will raise sales?"
Try It Yourself
Live Formulas Versus a Static Table
Grace answers carefully. "It says stores with higher prices sold less, across these ten stores. But the cheap stores may also be the ones in busy locations. So we cannot say price caused it. The matrix tells us where to look first, not what to do."
Try it yourself. Type the ten stores into a sheet. Then use CORREL to find the correlation of price with sales. You should get -0.4754. Then change the sales of store three, from 74 to 40. Recompute. Compare it with a ToolPak table made before the change. Which one changed?
Key Takeaways
Two Routes to a Correlation Matrix
Key takeaways. CORREL gives one correlation from two ranges of the same size. A correlation matrix lays out every pair. Build it by hand. Use CORREL. Or run the Correlation tool, in the Data Analysis ToolPak. Turn the add-in on in File, Options, Add-ins. The diagonal is all ones. The halves mirror each other. And the row of the outcome shows which variable goes with it most closely.
Next, in lesson 12.4, you will go from "do these move together?" to "how much will sales change?", with a regression line. This lesson was made by UPI Study.
About Marketing Research at UPI Study
Marketing Research (Marketing 300) is a self-paced online course of 101 video lessons in 13 chapters, from consumer behavior, segmentation and the research process to qualitative methods, surveys and sampling, measurement, experiments, secondary and syndicated data, descriptive statistics, hypothesis tests, correlation and regression, research ethics and reports. It carries a NCCRS credit recommendation for 3 semester credits.
Every lesson transcript is free on pages like this one, and the videos are free with a free UPI Study account. Enrolling adds a practice quiz after each lesson, the graded work and final exam that earn the credit, lifetime access, and an official transcript on completion. UPI Study has helped over 130,000 students with college credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
Enroll now → Course details Download the syllabus All Business courses Every credit course with PRO →
Why take it here
Why students take Marketing Research with UPI Study
Where the credit goes
Universities that work with NCCRS
Marketing Research carries a NCCRS credit recommendation. These universities work with NCCRS; some are UPI Study's signed partners. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
Thomas Edison State UniversitySigned partner
University of the PeopleSigned partner
Charter Oak State CollegeSigned partner
Strayer UniversitySigned partner
Columbia Southern UniversitySigned partner
Indiana TechSigned partner
Penn StateWorks with NCCRS
Southern New Hampshire UniversityWorks with NCCRS
SUNYWorks with NCCRS
+many more cooperating universitiesFind my college →Find my college → Not listed? Ask Athena in the corner of this page, or book a 15-minute call.
FAQ
Questions students ask us
About How to Build a Correlation Matrix in Excel
What is a correlation matrix?
How do you use the CORREL function in Excel?
How do you create a correlation matrix with the Data Analysis ToolPak?
Why does a ToolPak correlation table not update when the data change?
About the Marketing Research course
How many college credits is Marketing Research?
How much does Marketing Research cost and what is included?
Which universities accept UPI Study credits?
How long does Marketing Research take?
How are the exams done?
How do my credits reach my college?
Ready for the full course? Earn 3 credits in Marketing Research.
101 video lessons, a quiz after each one, and the graded work that earns the credit. Recommended for credit by NCCRS.
Updated
3 credits · NCCRSEnroll →