N
NeverLift
The situation: I have three columns, say A, G, Q; the first, A,
contains dates, G and Q are values on those dates. They are in
sequence by date. The data for each starts in row 14 (the prior rows
contain various labels, functions, etc.) I would like to determine
the correlation -- CORREL function -- of subsets of the data in G and
Q by entering a start date into a control cell, A6 and having the
CORREL function ranges automatically adjusted to start with the first
entry on that date. (Assume the data do not go past row 3000, with
unused rows at the end empty.)
So, I created the following formula:
=CORREL(INDIRECT("Q"&(MATCH($A$6,$A14:$A3000,0)+ROW($A13))&":Q3000"),
INDIRECT("G"&(MATCH($A$6,$A14:$A3000,0)+ROW($A13))&":G3000"))
The use of the ROW function is to ensure that the equation is adjusted
automatically if additional rows were to be inserted into the header
region later; using "+13" instead would not do this. (I'm not worried
about inserting additional columns, so "G" and "Q" are named
explicitly.) This construct is working fine in other formulas.
But: I'm getting a #NUM error here. When I enter a formula that
cites specific ranges, the value is computed just fine. Moreover, the
following works as well:
In cell B1: ="Q"&(MATCH($A$6,$A14:$A3000,0)+ROW($A13))&":Q3000"
In cell B2: ="G"&(MATCH($A$6,$A14:$A3000,0)+ROW($A13))&":G3000"
I can then see that the text in B1 and B2 selects the desired rows of
columns Q and G. And, =CORREL(INDIRECT(B1),INDIRECT(B2)) works just
fine!
As an experiment, I tried
=SUM(INDIRECT("Q"&(MATCH($A$6,$A14:$A3000,0)+ROW($A13))&":Q3000"))
which uses exactly the same computed range spec, character for
character (it was pasted) as the first argument of CORREL; it works
with no problem. Same for column G.
So, what is wrong with the original CORREL construct?
Thanks,
Gary
contains dates, G and Q are values on those dates. They are in
sequence by date. The data for each starts in row 14 (the prior rows
contain various labels, functions, etc.) I would like to determine
the correlation -- CORREL function -- of subsets of the data in G and
Q by entering a start date into a control cell, A6 and having the
CORREL function ranges automatically adjusted to start with the first
entry on that date. (Assume the data do not go past row 3000, with
unused rows at the end empty.)
So, I created the following formula:
=CORREL(INDIRECT("Q"&(MATCH($A$6,$A14:$A3000,0)+ROW($A13))&":Q3000"),
INDIRECT("G"&(MATCH($A$6,$A14:$A3000,0)+ROW($A13))&":G3000"))
The use of the ROW function is to ensure that the equation is adjusted
automatically if additional rows were to be inserted into the header
region later; using "+13" instead would not do this. (I'm not worried
about inserting additional columns, so "G" and "Q" are named
explicitly.) This construct is working fine in other formulas.
But: I'm getting a #NUM error here. When I enter a formula that
cites specific ranges, the value is computed just fine. Moreover, the
following works as well:
In cell B1: ="Q"&(MATCH($A$6,$A14:$A3000,0)+ROW($A13))&":Q3000"
In cell B2: ="G"&(MATCH($A$6,$A14:$A3000,0)+ROW($A13))&":G3000"
I can then see that the text in B1 and B2 selects the desired rows of
columns Q and G. And, =CORREL(INDIRECT(B1),INDIRECT(B2)) works just
fine!
As an experiment, I tried
=SUM(INDIRECT("Q"&(MATCH($A$6,$A14:$A3000,0)+ROW($A13))&":Q3000"))
which uses exactly the same computed range spec, character for
character (it was pasted) as the first argument of CORREL; it works
with no problem. Same for column G.
So, what is wrong with the original CORREL construct?
Thanks,
Gary