L
LurfysMa
I need a way to generate a cell address (row,column) from the value in
another cell and be able to use the contents of that in a calculation.
Here's my situation:
I have a table of mileage readings for my car taken at odd intervals.
Note that the "[Row]" column is the actual row number in the
spreadsheet and not part of the data. It is included because I want to
reference it later.
[Row] Date Odom Miles Days Mos Yrs M/Dy M/Mo Mi/Yr
13 3/13/05 48,041 1,141 50 1.64 0.14 23 695 8,335
14 7/10/05 50,922 2,881 119 3.91 0.33 24 737 8,843
15 10/29/05 52,176 1,254 111 3.65 0.30 11 344 4,126
16 12/15/05 55,338 3,162 47 1.54 0.13 67 2,048 24,573
17 5/01/06 57,767 2,429 137 4.50 0.38 18 540 6,476
18 6/30/06 58,494 727 60 1.97 0.16 12 369 4,426
19 10/12/06 62,144 3,650 104 3.42 0.28 35 1,068 12,819
20 2/02/07 65,368 3,224 113 3.71 0.31 29 868 10,421
21 3/12/07 65,719 351 38 1.25 0.10 9 281 3,374
The last column calculates the annualized miles/year based on the last
two readings. The reading are at irregular intervals, which makes it
difficult to calculate average mileage.
My idea was to add a row or two at the bottom of the table where I
would calculate the averages across enough intervals to span a year or
two. I could do the last 3 or 4 or 5 intervals and that would probably
be good enough, but what I'd like to do (maybe more for the learning
experience than the actual usefulness) is to add a new column (Row) in
which I could put the row number of the interval I want to compare
with. I could then choose an interval that is close to 1 or 2 or 3
years back and get the desired averages.
Here is an example using the data from the table above and choosing
rows that are about 1 and 2 years back. The new "Row" column is where
I would put the row number that I want to compare the last row in the
table against:
[Row] Row Date Odom Miles Days Mos Yrs M/Dy M/Mo Mi/Yr
23 16 12/15/05 55,338 10,381 452 14.85 1.24 23 699 8,389
24 13 3/13/05 48,041 17,678 729 23.95 2.00 24 738 8,857
This table was generated using actual cell references. The date cell
is "=B16", the Odom cell is "=C16", the Miles cell is "=C21-C16", and
the Miles cell is "=B21-B16".
What I need is a way to replace the "16" in each of these formulas
with the contents of cell A23. I can't seem to quite get it to work.
I think the solution is some combination of the cell() function and
the address() function, but I can't get it to work.
Using the address() function, I was able to obtain the address of the
cell:
=ADDRESS(A26,2) ==> "$B$16"
=ADDRESS(A26,2,4) ==> "B16"
Using the cell() function, I was able to obtain the contents of the
cell:
=CELL("contents",B16) ==> 12/15/05
=CELL("contents",C16) ==> 55,338
But when I try to combine these functions, I get an error:
=CELL("contents",ADDRESS(A26,2,4)) ==> Error
What am I doing wrong?
another cell and be able to use the contents of that in a calculation.
Here's my situation:
I have a table of mileage readings for my car taken at odd intervals.
Note that the "[Row]" column is the actual row number in the
spreadsheet and not part of the data. It is included because I want to
reference it later.
[Row] Date Odom Miles Days Mos Yrs M/Dy M/Mo Mi/Yr
13 3/13/05 48,041 1,141 50 1.64 0.14 23 695 8,335
14 7/10/05 50,922 2,881 119 3.91 0.33 24 737 8,843
15 10/29/05 52,176 1,254 111 3.65 0.30 11 344 4,126
16 12/15/05 55,338 3,162 47 1.54 0.13 67 2,048 24,573
17 5/01/06 57,767 2,429 137 4.50 0.38 18 540 6,476
18 6/30/06 58,494 727 60 1.97 0.16 12 369 4,426
19 10/12/06 62,144 3,650 104 3.42 0.28 35 1,068 12,819
20 2/02/07 65,368 3,224 113 3.71 0.31 29 868 10,421
21 3/12/07 65,719 351 38 1.25 0.10 9 281 3,374
The last column calculates the annualized miles/year based on the last
two readings. The reading are at irregular intervals, which makes it
difficult to calculate average mileage.
My idea was to add a row or two at the bottom of the table where I
would calculate the averages across enough intervals to span a year or
two. I could do the last 3 or 4 or 5 intervals and that would probably
be good enough, but what I'd like to do (maybe more for the learning
experience than the actual usefulness) is to add a new column (Row) in
which I could put the row number of the interval I want to compare
with. I could then choose an interval that is close to 1 or 2 or 3
years back and get the desired averages.
Here is an example using the data from the table above and choosing
rows that are about 1 and 2 years back. The new "Row" column is where
I would put the row number that I want to compare the last row in the
table against:
[Row] Row Date Odom Miles Days Mos Yrs M/Dy M/Mo Mi/Yr
23 16 12/15/05 55,338 10,381 452 14.85 1.24 23 699 8,389
24 13 3/13/05 48,041 17,678 729 23.95 2.00 24 738 8,857
This table was generated using actual cell references. The date cell
is "=B16", the Odom cell is "=C16", the Miles cell is "=C21-C16", and
the Miles cell is "=B21-B16".
What I need is a way to replace the "16" in each of these formulas
with the contents of cell A23. I can't seem to quite get it to work.
I think the solution is some combination of the cell() function and
the address() function, but I can't get it to work.
Using the address() function, I was able to obtain the address of the
cell:
=ADDRESS(A26,2) ==> "$B$16"
=ADDRESS(A26,2,4) ==> "B16"
Using the cell() function, I was able to obtain the contents of the
cell:
=CELL("contents",B16) ==> 12/15/05
=CELL("contents",C16) ==> 55,338
But when I try to combine these functions, I get an error:
=CELL("contents",ADDRESS(A26,2,4)) ==> Error
What am I doing wrong?