Excel - Correlation Matrix using VBA

Asked By Zohe on 16-Feb-09 02:01 PM

I was wondering if anyone was able to provide some assistance to produce a
correlation matrix code in VBA?

Any help would be greatful


M1kehail replied on 16-Feb-09 03:16 PM
Range? sheet? cell?
Mike Middleton replied on 16-Feb-09 04:01 PM
Zoheb  -

The Correlation tool of Excel's Analysis ToolPak provides this feature,
i.e., all pairwise correlation coefficients for data sets with two or more
variables. The results are equivalent to using the CORREL worksheet function
on pairs of variables in a multivariate data set.

Do you want to replicate that functionality, or do you want something that
the Correlation tool doesn't provide?

-  Mike Middleton
Zohe replied on 16-Feb-09 04:26 PM
Mike -

Thanks for the response

I have 30 sets of data over a certain time period and want to produce a
correlation matrix of it.

I have used the Analysis ToolPak to calculate what the answers should be and
I want to replicate this in VBA, preferably using loop functions.


Mike Middleton replied on 17-Feb-09 03:50 PM
Zoheb  -

I'm working on other projects, and I'm not interested in writing VBA code to
replicate the Analysis ToolPak.

If you have thought about the exact specifications, like the specific input
data and specific output, and if you have decided how general-purpose you
want your code to be (variable number of columns, etc.), then if you post
the code you have so far, it's likely that someone will help you.

-  Mike