+ Reply to Thread
Results 1 to 13 of 13

Automatically move a formula line down when new data is added

  1. #1
    Forum Contributor
    Join Date
    11-20-2011
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2007, Excel 2003, Excel 2010
    Posts
    284

    Automatically move a formula line down when new data is added

    Hello:

    I have data in A1 to A10 and used the following =SUM(A$1:A10) formula in A12 to sum the data and keep summing new data that might be added. Is there a way to automatically keep moving A12 down one row as new data is added. When I manually add a new row the sum is updated and accounts for the new data but i am trying to find a way for it to automatically move down since the data in the sheet will be autopopulated so i would need it to move down by however many new rows are added.

    Thanks
    Last edited by rlsublime; 11-22-2011 at 04:47 PM.

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Automatically move a formula line down when new data is added

    Copy and paste the code to the worksheet module that contain the sum formula

    Please Login or Register  to view this content.

  3. #3
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Automatically move a formula line down when new data is added

    You could use a dynamic range such as...

    =SUM(A1:INDEX(A:A,MATCH(9.99999999999999E+307,A:A)))

    This looks for the last value in column A and then makes a reference to the range...

    http://xldynamic.com/source/xld.LastValue.html

    Sorry, just realized you wanted it it the same column...
    Last edited by jeffreybrown; 11-22-2011 at 04:53 PM.
    HTH
    Regards, Jeff

  4. #4
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Automatically move a formula line down when new data is added

    Here is a sample file that I worked on. Not exactly sure if this is what you need.
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    11-20-2011
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2007, Excel 2003, Excel 2010
    Posts
    284

    Re: Automatically move a formula line down when new data is added

    thanks Jen. How could I expand this for all worksheets (Col A to Col J)?
    For example, the formula works perfectly in the A column of sheet 1, but how would I make it accessible by all sheets in a workbook from Column A to J?

    Thanks

  6. #6
    Forum Contributor
    Join Date
    11-20-2011
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2007, Excel 2003, Excel 2010
    Posts
    284

    Re: Automatically move a formula line down when new data is added

    Also, I am trying to get everything below the formula line to also move down with the formula.
    Thanks

  7. #7
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Automatically move a formula line down when new data is added

    jeffreybrown,

    This formula should avoid the circular reference. I realize this still doesn't solve the OP's problem, but I figured I'd provide my useless input.

    =SUM(A1:INDEX(A:A,ROW()-1))

  8. #8
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Automatically move a formula line down when new data is added

    Whizbang,

    Not useless input at all. I was trying to get ride of that circular reference, but in the end it had more punch than I Many thanks...

  9. #9
    Forum Contributor
    Join Date
    11-20-2011
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2007, Excel 2003, Excel 2010
    Posts
    284

    Re: Automatically move a formula line down when new data is added

    This works too, but i am trying to figure out how to lock the row above it and display the formula and everything below the A12 line.

    =SUM(A$1:A11)

  10. #10
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Automatically move a formula line down when new data is added

    Try this:
    Please Login or Register  to view this content.

    This will only grow. It will not shrink if values are deleted.

  11. #11
    Forum Contributor
    Join Date
    11-20-2011
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2007, Excel 2003, Excel 2010
    Posts
    284

    Re: Automatically move a formula line down when new data is added

    Whizbang: The code was not running for some reason. It was giving an error message.

    Thanks

  12. #12
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Automatically move a formula line down when new data is added

    What was the error. What change did you attempt? Please provide more information on your error. I just realized that the above code does not check the size of Target, and so might throw an error if multiple cells are changes at once.

  13. #13
    Forum Contributor
    Join Date
    11-20-2011
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2007, Excel 2003, Excel 2010
    Posts
    284

    Re: Automatically move a formula line down when new data is added

    Is there a way to edit this code to add data between the SummaryRow?

    I tried to Set a range but I there seems to be an issue and it is not pasting between the SummaryRow.
    Set rTo3 = .Range("SummaryRow").Offset(-1).EntireRow.Cells(1, 1).Resize(1, lRightCol)

    Thanks

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1