L
LurfysMa
There has to be a way to extend an array in Excel and have all of the
references update correctly.
I have a spreadsheet for tracking mileage on my car. The heart of the
spreadsheet is an array (table) of mileage readings at irregular
intervals. Here is some sample data showing row and column numbers.
B C D E
Date Odom Miles Days
17 6/13/05 51,114 2,956 (=C17-C16) 294 (=B17-B16)
18 6/14/05 51,132 18 (=C18-C17) 1 (=B18-B17)
19 3/23/06 54,169 3,037 (=C19-C18) 282 (=B19-B18)
20 3/12/07 58,255 4,086 (=C20-C19) 354 (=B20-B19)
This array, then, is B1320.
The spreadsheet also contains lots of other calculations based on this
array including several match() and index() functions. Many of these
depend on trhe "last" entry on the array (currently B20).
=INDEX(B17:B20,Q23,COLUMN(B20)
I would like a method that I can use to add a row (21) to the array
and have:
1. The new row acquire all of the attributes of the other rows, and
2. All references the last row (20) be updated to the enw last row
(21).
Here's what I've tried that doesn't work:
Drag-copy last row down.
* Select the last row (20)
* Ctrl-shift-drag the top border to the bottom.
This works perfectly for adding the new row. It acquires all fo the
attributes of the old last row. All I need to do is enter the new date
and odometer reading and everything works.
- However, references to "B20" from outside the array do not get
updated.
Drag-copy & insert last row up. This fails. When I try to Ctrl-shift
drag the bottom border to the top, nothing happens.
Insert a row below the last row.
* Select the row after the last row (21)
* Right click
* Select Insert
This adds a row, which inherits the cell formatting, but not the
formulas. It also does not affect references to B20.
Insert a row between last 2 rows.
* Select last row (20)
* Right click
* Select Insert
This almost works. It inserts a new row 20 and shoves 20 to 21. This
gets the references to B20 updated to B21. Unfortunately, the formulas
in rows 20 and 21 get messed up. Those that used to read =B20-B21 now
read =B20-B18 -- a 2-row difference. I can fix that by copying the row
above and updating all the formulas, but that should not be necessary.
Paste-insert row 20 after row 20.
* Select the last row (20)
* Right click
* Select Insert
This almost works, too. I get a new row that looks just like row 20
except that the formulas are off again. A similar thing happens if I
paste-insert between the last 2 rows.
Help. This ought to be easy. Surely people need to do this all the
time.
references update correctly.
I have a spreadsheet for tracking mileage on my car. The heart of the
spreadsheet is an array (table) of mileage readings at irregular
intervals. Here is some sample data showing row and column numbers.
B C D E
Date Odom Miles Days
17 6/13/05 51,114 2,956 (=C17-C16) 294 (=B17-B16)
18 6/14/05 51,132 18 (=C18-C17) 1 (=B18-B17)
19 3/23/06 54,169 3,037 (=C19-C18) 282 (=B19-B18)
20 3/12/07 58,255 4,086 (=C20-C19) 354 (=B20-B19)
This array, then, is B1320.
The spreadsheet also contains lots of other calculations based on this
array including several match() and index() functions. Many of these
depend on trhe "last" entry on the array (currently B20).
=INDEX(B17:B20,Q23,COLUMN(B20)
I would like a method that I can use to add a row (21) to the array
and have:
1. The new row acquire all of the attributes of the other rows, and
2. All references the last row (20) be updated to the enw last row
(21).
Here's what I've tried that doesn't work:
Drag-copy last row down.
* Select the last row (20)
* Ctrl-shift-drag the top border to the bottom.
This works perfectly for adding the new row. It acquires all fo the
attributes of the old last row. All I need to do is enter the new date
and odometer reading and everything works.
- However, references to "B20" from outside the array do not get
updated.
Drag-copy & insert last row up. This fails. When I try to Ctrl-shift
drag the bottom border to the top, nothing happens.
Insert a row below the last row.
* Select the row after the last row (21)
* Right click
* Select Insert
This adds a row, which inherits the cell formatting, but not the
formulas. It also does not affect references to B20.
Insert a row between last 2 rows.
* Select last row (20)
* Right click
* Select Insert
This almost works. It inserts a new row 20 and shoves 20 to 21. This
gets the references to B20 updated to B21. Unfortunately, the formulas
in rows 20 and 21 get messed up. Those that used to read =B20-B21 now
read =B20-B18 -- a 2-row difference. I can fix that by copying the row
above and updating all the formulas, but that should not be necessary.
Paste-insert row 20 after row 20.
* Select the last row (20)
* Right click
* Select Insert
This almost works, too. I get a new row that looks just like row 20
except that the formulas are off again. A similar thing happens if I
paste-insert between the last 2 rows.
Help. This ought to be easy. Surely people need to do this all the
time.