![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Feb 2002
Posts: 40
|
I have a formula that I would like to change as rows are added above it. If the formula is in A8 then I want the formula to SUM(A2:A7), but as rows are added I want the formula to account for this (ex./ SUM(A2:A59) if the formula is bumped down to A60). Basically, I want the formula to add up A2 through A"one cell above this position".
Any help GREATLY appreciated!! Lindsay |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Feb 2002
Location: Chippenham, UK
Posts: 136
|
Normally when you insert a line above a SUM function it will also SUM the value of the added line.
Is this not happening on your sheet?
__________________
Regards, Gary Hewitt-Long |
|
|
|
|
|
#3 |
|
New Member
Join Date: Feb 2002
Posts: 40
|
If I have sum(A2:A11) in cell A12 and then I insert a row above row 12, the formula stays sum(A2:A11). If I add rows further up in the spreadsheet, the formula changes like I want, but rows are always added at the bottom, so that doesn't help me.
Lindsay [ This Message was edited by: chezlinds on 2002-02-26 17:18 ] |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Feb 2002
Posts: 202
|
sounds like you need a dynamic named range to refer to in your formula instead of a fixed range of cells. dave hawley's site at http://www.ozgrid.com has more info on how to create these, or you could check the mr excel archive pages for the procedure.
|
|
|
|
|
|
#5 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,314
|
Quote:
=SUM(OFFSET(A2,0,0,MATCH(9.99999999999999E+307,A:A))) You can even have this in A2, provided that you change A2 in OFFSET to A3. The reason for this change is that the first arg of OFFSET tells where the data to sum begin. |
|
|
|
|
|
|
#6 |
|
Board Regular
Join Date: Feb 2002
Posts: 202
|
oops. forgot that you can't use a dynamic range if the formula that uses it is in the same column. aladin's is a much better idea, although i don't quite get what the match function is doing.
[ This Message was edited by: anno on 2002-02-26 18:51 ] |
|
|
|
|
|
#7 |
|
Join Date: Feb 2002
Posts: 39
|
Why not just use :-
=SUM(A2:OFFSET(A8,-1,0)) |
|
|
|
|
|
#8 |
|
Board Regular
Join Date: Feb 2002
Location: Perth Australia
Posts: 1,567
|
removed
[ This Message was edited by: Derek on 2002-02-26 20:25 ] |
|
|
|
|
|
#9 | |
|
Guest
Posts: n/a
|
Quote:
|
|
|
|
|
#10 | ||
|
Guest
Posts: n/a
|
Quote:
|
||
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|