How can I do this one excel?

So essentially what i want to do...i get a correlation analysis of 20 different stocks / industries to each other..with the daily prices for the past 10 years.....whats the best software / or method of doing this?....can this be done on excel? or is reuters or another software better for this? ...also...whats a good database to get the stock prices in a nice downloadable excel file?....and if i am using excel...is there anyway to build a macro that automates the process of having to manually do a correlation for each two rows of data prices for the past 10 years?.....any feedback is greatly appreciated..thanks

6 Comments
 

In excel, put the data into columns. If you haven't already, install Data Analysis for Excel. Go to Tools -> Data Analysis. Select Correlation and go from there.

Jack: They’re all former investment bankers who were laid off from that economic crisis that Nancy Pelosi caused. They have zero real world skills, but God they work hard. -30 Rock
 

If you have a bloomberg terminal this is actually pretty easy to do and would not be that time consuming at all.

Alternatively you can pull data from yahoo finance.

I really want to learn VBA/Macros as I often find myself needing to do a lot of goofy stuff in excel but end up taking a bunch of uncessary steps that i wouldnt otherwise need to w/o excel. I suck with programming in general so its been something i have wanted to learn just never got around to it.

"Oh the ladies ever tell you that you look like a fucking optical illusion" - Frank Slaughtery 25th Hour.

"Oh the ladies ever tell you that you look like a fucking optical illusion" - Frank Slaughtery 25th Hour.
 
Best Response

VBA is your friend. The code for 1-2 requires a bit more, well, code, but here's some pseudo-code for step 3:

1 - pull data sets from yahoo finance (search for ichart.finance.yahoo.com and csv for more info on this) using web queries 2 - dump it on a worksheet, one column/stock 3 - Run your correlation analysis, whatever it is (p-test, r^2, correl, etc.) through a nested for loop

Code-sort of for #3, assuming that each column in row 1 has a header: Dim i, j as Integer Const statFormula as String = "=CORREL(range_x, range_y)" 'change me For i = 1 to ActiveSheet.Range("A1").End(xlToRight).Column - 1 For j = i + 1 to ActiveSheet.Range("A1").End(xlToRight).Column ActiveSheet.Cells(1,i).End(xlDown).Offset(2(j - i),0).Value = ActiveSheet.Cells(1,i).Value & "-" & ActiveSheet.Cells(1,j).Value ActiveSheet.Cells(1,i).End(xlDown).Offset(2(j - i) + 1, 0).Formula = Replace(Replace(statFormula, "range_x", Range(ActiveSheet.Cells(2,i), ActiveSheet.Cells(2,i).End(xlDown)).AddressLocal(False,False)), "range_y", Range(ActiveSheet.Cells(2,j), ActiveSheet.Cells(2,j).End(xlDown)).AddressLocal(False,False)) Next Next

Feel free to PM me with questions on the code / VBA in general

 

oh man the things i could do if I knew how to code like that. Wanna help me backtest some trading strategies and develop the black box? lol.

"Oh the ladies ever tell you that you look like a fucking optical illusion" - Frank Slaughtery 25th Hour.

"Oh the ladies ever tell you that you look like a fucking optical illusion" - Frank Slaughtery 25th Hour.
 
trade4sizeoh man the things i could do if I knew how to code like that. Wanna help me backtest some trading strategies and develop the black box? lol.

lol, that's pretty much what I've been doing for the last ~4 months at work...

 

Dignissimos sequi quae sed accusamus. Adipisci consequuntur ut minima vel. Voluptatibus incidunt autem sequi a ipsum.

Jack: They’re all former investment bankers who were laid off from that economic crisis that Nancy Pelosi caused. They have zero real world skills, but God they work hard. -30 Rock

Career Advancement Opportunities

September 2026 Investment Banking

  • Evercore 01 99.5%
  • Moelis & Company 01 98.9%
  • JPMorgan 01 98.4%
  • Goldman Sachs 01 97.8%
  • Morgan Stanley 07 97.3%

Overall Employee Satisfaction

September 2026 Investment Banking

  • Moelis & Company No 99.5%
  • Morgan Stanley 02 98.9%
  • Evercore 01 98.4%
  • Banco Santander 02 97.8%
  • BMO Capital Markets 12 97.3%

Professional Growth Opportunities

September 2026 Investment Banking

  • Evercore 01 99.5%
  • Moelis & Company 01 98.9%
  • Morgan Stanley 07 98.4%
  • Goldman Sachs 01 97.8%
  • JPMorgan No 97.3%

Total Avg Compensation

September 2026 Investment Banking

  • Vice President (16) $429
  • Associates (51) $260
  • 3rd+ Year Analyst (8) $210
  • 2nd Year Analyst (26) $182
  • Intern/Summer Associate (14) $159
  • 1st Year Analyst (84) $151
  • Intern/Summer Analyst (76) $101
notes
16 IB Interviews Notes

“... there’s no excuse to not take advantage of the resources out there available to you. Best value for your $ are the...”

Leaderboard

1
redever's picture
redever
99.2
2
BankonBanking's picture
BankonBanking
99.0
3
kanon's picture
kanon
99.0
4
Secyh62's picture
Secyh62
99.0
5
Betsy Massar's picture
Betsy Massar
98.9
6
CompBanker's picture
CompBanker
98.9
7
GameTheory's picture
GameTheory
98.9
8
dosk17's picture
dosk17
98.9
9
DrApeman's picture
DrApeman
98.9
10
numi's picture
numi
98.8
success
From 10 rejections to 1 dream investment banking internship

“... I believe it was the single biggest reason why I ended up with an offer...”