- For individual users
- Instant access to solutions
- Ask your tech questions
- Start your 30-day Free Trial
Main Topics
Browse All TopicsNote: Edited to add row & column references to make table easier to read
Edited to remove ambiguity about manual calculations
Hello Experts,
I'm trying to use Lookup and Reference functions to dynamically define the ranges used by various statistical calculations like AVERAGE, STDEV, CORREL.
The approach i have in mind is to use a a user defined functions for each calculation, using SecurityA, SecurityB, #daysHistory as required parameters.
My workbook has two sheets:
PairList! (note: this sheet might have up to 700 rows)
user input---------------------
SecurityA SecurityB #DaysHistory fnRatioAvg fnRatioStdDev fnCorrelation
1 HK 20 HK 5 HELP! i'll do myself later i'll do myself later
4 HK 20 HK 5 HELP! i'll do myself later i'll do myself later
...
...
Price! (note: this sheet might have up to 65000 rows and 700 securities)
I have currently sorted it ASCENDING, but could change to DESCENDING if the lookups are more efficient.
A B C
1 SecurityID Date Price
2 1 HK Equity 8/10/2006 84.85
3 1 HK Equity 8/11/2006 84.9
4 1 HK Equity 8/14/2006 85.25
5 1 HK Equity 8/15/2006 85.6
6 1 HK Equity 8/16/2006 86.85
7 1 HK Equity 8/17/2006 87.85
8 1 HK Equity 8/18/2006 88.25
9 1 HK Equity 8/21/2006 87.05
10 20 HK Equity 8/10/2006 13.48
11 20 HK Equity 8/11/2006 13.62
12 20 HK Equity 8/14/2006 13.52
13 20 HK Equity 8/15/2006 13.5
14 20 HK Equity 8/16/2006 13.74
15 20 HK Equity 8/17/2006 13.62
16 20 HK Equity 8/18/2006 13.6
17 20 HK Equity 8/21/2006 13.5
18 4 HK Equity 8/10/2006 28.8
19 4 HK Equity 8/11/2006 28.7
20 4 HK Equity 8/14/2006 28.55
21 4 HK Equity 8/15/2006 28.5
22 4 HK Equity 8/16/2006 28.8
23 4 HK Equity 8/17/2006 28.8
24 4 HK Equity 8/18/2006 28.65
25 4 HK Equity 8/21/2006 28.35
...
...
Assuming data for both Prices! and PairList start in cell A1 (with headers), manually the calculations for the first pair (1 HK / 20 HK) would be
={AVERAGE(Prices!C7:C9/Pri
={STDEV(Prices!C7:C9/Price
={CORREL(LN(Prices!C7:C9/P
The result table looks like this:
SecurityA SecurityB #DaysHistory fnRatioAverage fnRatioStdDev fnCorrelation
1 HK Equity 20 HK Equity 3 6.4624 0.0230 7%
4 HK Equity 20 HK Equity 3 2.1071 0.0073 -18%
The problem I have is defining the ranges dynamically with reference to SecurityA, SecurityB, #daysHistory in the pair table.
I'm experimenting with various Lookup and Reference functions (eg VLOOKUP, COLUMN, ROW, INDEX, INDIRECT, OFFSET, MATCH).
If someone could help me with fnRatioAverage, I should be able to do fnRatiopStdDev, fnCorrelation on my own.
Any suggestions much appreciated. Thanks.
-Tom
This question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership