How to Calculate Correlation Between Two Stocks in Excel
Paste your two stock series, choose whether you entered prices or returns, then calculate Pearson correlation instantly. Includes scatter chart and trend line.
Complete Expert Guide: How to Calculate Correlation Between Two Stocks in Excel
If you are building a serious portfolio, measuring correlation is one of the most practical things you can do in Excel. Correlation tells you whether two stocks tend to move in the same direction, opposite directions, or independently. This matters because portfolio risk is not just about how risky each stock is on its own, but also about how those stocks behave together.
In plain language, correlation is a number between -1 and +1. A value near +1 means the stocks usually rise and fall together. A value near -1 means they often move in opposite directions. A value near 0 means there is no strong linear relationship. Excel makes this easy through built-in formulas, but the quality of your answer depends heavily on how clean your data is and whether you use returns instead of raw prices.
Why correlation matters for investors
- Risk control: Two highly correlated stocks can increase concentration risk even if they are in different companies.
- Diversification: Combining assets with lower correlation can reduce portfolio volatility.
- Position sizing: You can avoid unintentionally doubling exposure to the same market factor.
- Hedging and pair strategies: Correlation helps identify candidates for relative-value setups.
Step 1: Gather clean, aligned data
Before running a formula, make sure your time series are aligned by date. If Stock A has trading values for dates that Stock B does not, correlation can be distorted. Use matching intervals such as daily close-to-close, weekly close, or month-end close for both stocks.
Authoritative education on investing fundamentals and risk concepts can be found at Investor.gov. For statistical background on correlation methods, see Penn State STAT resources. For company filing data and disclosures that can inform your stock universe, use SEC EDGAR.
Use returns, not raw prices
This is a critical point. Correlation on raw prices often overstates relationships because many prices trend over time. You should calculate periodic returns first:
- Put Stock A prices in column B, Stock B prices in column C.
- In D3 (Stock A return), enter:
=(B3/B2)-1. - In E3 (Stock B return), enter:
=(C3/C2)-1. - Fill down both return columns.
- Now use these return columns for correlation.
Step 2: Calculate correlation with Excel formulas
Excel gives you two equivalent functions for this use case:
=CORREL(array1,array2)=PEARSON(array1,array2)
If your returns are in D3:D62 and E3:E62, use:
=CORREL(D3:D62,E3:E62).
The output is your Pearson correlation coefficient.
Interpreting your output quickly
| Correlation (r) | Relationship Strength | Portfolio Interpretation |
|---|---|---|
| +0.70 to +1.00 | Strong positive | Stocks likely move together; limited diversification benefit. |
| +0.30 to +0.69 | Moderate positive | Some diversification but still meaningful co-movement. |
| -0.29 to +0.29 | Weak or none | Useful for diversification if other risk metrics fit. |
| -0.30 to -0.69 | Moderate negative | Potential hedge-like behavior in some regimes. |
| -0.70 to -1.00 | Strong negative | Powerful diversification potential, but rare among same-asset equities. |
Step 3: Validate with scatter plots
Numbers are useful, but visuals can prevent mistakes. Insert a scatter chart with Stock A returns on the X-axis and Stock B returns on the Y-axis. If points form an upward cloud, correlation is positive. A downward cloud suggests negative correlation. If points are widely dispersed with no clear slope, correlation is weak.
In Excel:
- Select both return columns.
- Insert → Scatter (only markers).
- Right-click data series → Add Trendline.
- Optionally display equation and R-squared.
The slope gives directional tendency, while R-squared tells you how much variance in one stock is linearly explained by the other. R-squared is simply correlation squared for a two-variable linear model.
Real-world historical context with example statistics
Correlation values vary by market regime, sampling window, and frequency. Using monthly returns over a long horizon often produces more stable estimates than short daily windows. The table below shows representative long-window correlations often observed across broad U.S. market benchmarks and related assets.
| Asset Pair (Monthly Returns) | Representative Correlation | Practical Meaning |
|---|---|---|
| S&P 500 vs Nasdaq-100 | 0.90 | Very high overlap in growth and broad equity risk factors. |
| S&P 500 vs Russell 2000 | 0.84 | Strong equity co-movement, though small caps can diverge in stress periods. |
| S&P 500 vs MSCI EAFE | 0.76 | International diversification helps, but global risk-on cycles remain linked. |
| S&P 500 vs U.S. 7-10Y Treasuries | -0.18 | Historically modest diversification, stronger in some risk-off episodes. |
Important: correlations are not constants. During market shocks, many equity correlations rise toward 1.00, reducing diversification exactly when investors need it most.
Common Excel mistakes and how to avoid them
1) Using price levels directly
This is the biggest error. Always convert prices to returns first. Price series can trend, creating misleadingly high correlation.
2) Date mismatch
If one stock has holidays, halted days, or missing records, your series can become offset. Use aligned dates and remove rows where one side is missing.
3) Too few observations
Correlation from 10 points is unstable. For practical analysis, many analysts use at least 36 monthly observations or 252 daily observations depending on objective.
4) Ignoring outliers
Extreme moves can dominate the coefficient. Inspect scatter plots and consider robust checks if one event drives most of the relationship.
5) Mixing frequencies
Do not compare daily returns for one stock and weekly returns for another. Use the same frequency and period boundaries.
Advanced workflow: rolling correlation in Excel
Static correlation gives one summary value. Rolling correlation shows how the relationship changes through time. For a 60-day rolling correlation:
- Calculate returns in columns D and E.
- In F62 enter
=CORREL(D3:D62,E3:E62). - In F63 enter
=CORREL(D4:D63,E4:E63). - Fill down to the last row.
- Plot column F as a line chart.
This is especially useful when comparing cyclical stocks, sector rotation behavior, or macro-sensitive names. You will often see correlation increase in crises and decrease in calmer periods.
How this calculator maps to Excel logic
The calculator above follows the same process you would use in Excel:
- If you input prices, it converts to period-over-period returns.
- It computes Pearson correlation exactly from aligned return vectors.
- It reports covariance, trend slope, and R-squared for additional context.
- It draws a scatter plot plus trend line so you can visually inspect fit quality.
This means you can use it to sanity-check your worksheet and verify that your Excel formulas are behaving as expected.
Practical decision framework
Correlation alone should never drive a buy or sell decision, but it is valuable in combination with volatility, valuation, and fundamentals. A practical routine many professionals follow:
- Screen candidate stocks by quality and thesis.
- Estimate return volatility and drawdown profile.
- Calculate pairwise correlations against current holdings.
- Model portfolio-level risk impact before adding the position.
- Recalculate monthly or quarterly to track regime changes.
Final takeaway
Learning how to calculate correlation between two stocks in Excel is a high-impact skill for portfolio construction. The formula itself is simple, but reliable results require disciplined data preparation, proper return conversion, and interpretation in context. If you use aligned return data, validate with charts, and monitor rolling behavior over time, correlation becomes a practical risk tool rather than a textbook number.