Correlation using lookups

Woofy_McWoof_Woof

Board Regular
Joined
Oct 7, 2016
Messages
60
Office Version
  1. 365
Platform
  1. Windows
[TABLE="width: 500"]
<tbody>[TR]
[TD]A - Month
[/TD]
[TD]B - Date
[/TD]
[TD]C - Period
[/TD]
[TD]D - Price A
[/TD]
[TD]E -Price b
[/TD]
[/TR]
[TR]
[TD]=date(year(B2),month(B2),1)
[/TD]
[TD]01/01/2010
[/TD]
[TD]1
[/TD]
[TD]32.22
[/TD]
[TD]33.01
[/TD]
[/TR]
[TR]
[TD]=date(year(B3),month(B3),1)
[/TD]
[TD]01/01/2010
[/TD]
[TD]2
[/TD]
[TD]30.72
[/TD]
[TD]31.78
[/TD]
[/TR]
[TR]
[TD]=date(year(B4),month(B4),1)
[/TD]
[TD]01/01/2010
[/TD]
[TD]3
[/TD]
[TD]30.91
[/TD]
[TD]30.65
[/TD]
[/TR]
[TR]
[TD]=date(year(B5),month(B5),1)
[/TD]
[TD]01/01/210
[/TD]
[TD]4
[/TD]
[TD]25.91
[/TD]
[TD]29.32
[/TD]
[/TR]
</tbody>[/TABLE]
Hi

I'm attempting to prove if there is a correlation between two sets of prices from January 2010 - August 2018. For each day there are 48 period, so for January 2010 there are 1,488 rows of data to look at. In order to simplify things I have set the correlation to look at all the reference cells in January 2010 which means the reference is (simplistically) =CORREL(D2:D1489,E2:E1489). This is fine as it gives me the result I need, however, it is a manually process which means if I have to redo the formula for each month up to August 2018 it will take forever.
Is there a way for the correlation formula to look up the month required and to then calculate the result after looking at all applicable cells in that month? Ideally I would then just drag the formula own for all the remaining months so for instance Jan 2010 = X, Feb 2010 = y etc.

Thank for your help. If you need any more info then please let me know.

Woof
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
You can just create a set of arrays within function CORREL to filter for the dates. Like this, where I used only two days of Jan 2010 to create my sample data:


Book1
GHI
1MonthYearCorrelation A|B
212010-0.099841564
322010
Sheet48
Cell Formulas
RangeFormula
I2=CORREL((YEAR($B$2:$B$97)=H2)*(MONTH($B$2:$B$97)=G2)*$D$2:$D$97,(YEAR($B$2:$B$97)=H2)*(MONTH($B$2:$B$97)=G2)*$E$2:$E$97)
<strike>
</strike>
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,254
Members
452,623
Latest member
Techenthusiast

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