worksheetfunction.index array form

SBF12345

Well-known Member
Joined
Jul 26, 2014
Messages
614
I am working with the lines:

Code:
ArrX = Application.WorksheetFunction.Index(X, 0, 2)
    ArrTemp = Application.WorksheetFunction.Index(TempSample, 0, 2)
DistanceMeasure = (1 - Application.WorksheetFunction.Correl(ArrX, ArrTemp)) * 100

I would like to be able to run a simple correlation using arrays with a variable length of objects defined by worksheet inputs and dim as variant. My goal is to be able to run the correlation using all the values in the variant X and variant TempSample. Both have the same number of objects.

what is the correct syntax to do so?

when I do the correlation calculation long hand my values are different. Thanks!
 
Last edited:

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Code:
For gg = 1 To NumObs    
    ArrX(gg) = Application.WorksheetFunction.Index(X, gg, 2)
    ArrTemp(gg) = Application.WorksheetFunction.Index(TempSample, gg, 2)
    ArrX1(gg) = Application.WorksheetFunction.Index(X, gg, 3)
    ArrTemp1(gg) = Application.WorksheetFunction.Index(TempSample, gg, 3)
    
    Next gg

I added this code and it seems to be loading the arrays fine.
 
Upvote 0

Forum statistics

Threads
1,215,043
Messages
6,122,825
Members
449,096
Latest member
Erald

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top