+ Reply to Thread
Results 1 to 6 of 6

Autosum after Insert Row

  1. #1
    Insomniac53
    Guest

    Autosum after Insert Row

    I only use Excel when I really have to so excuse this question if it's missing some basic understanding. I can get into VBA and macros if necessary, but it hurts. The actual workbook is much more complicated than the following simplified problem, but the principle is the same:

    A column has 11 rows of numbers and in the 11th row is an autosum =SUM(A1:A10). Standard stuff. However, when a new row is inserted at row 11, the new 12th row should now read =SUM(A1:A11) but it remains as it was, to A10.

    I would have thought it logical for Excel to update the row count automatically, but it doesn't. Is there a simple way to do this or using VBA if absolutely necessary?

    Thanks.
    Last edited by Insomniac53; 07-05-2011 at 05:28 AM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,243

    Re: Autosum after Insert Row

    You could try:

    =SUM(A1:OFFSET(A12,-1,0))


    Oddly enough, I've just tested this in Excel 2007 and when I insert the row and then put a number in, the formula that was in A11 and is now in A12 does automatically adjust.

    You might find that it's an Excel setting that automatically adjusts the formula in these circumstances but that's just a guess.

    Anyway, the OFFSET formula will work regardless.


    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Insomniac53
    Guest

    Re: Autosum after Insert Row

    Excellent! Works a treat. Many thanks.
    As a point of interest, there are four other columns with similar sums. Three use autosum and have (or rather 'had') the same issue. The fourth column looks across the 'totals' rows and adds them, something like =A11+B11+C11, and this one updates correctly to =A12+B12+C12 when a row is inserted. I shall look for a setting, but probably not too hard as your answer solves the problem.
    Thanks again!

  4. #4
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Autosum after Insert Row

    In 2003 : Tools - Options - Edit - "extend data range..." should be checked to achieve this ( formula adapts when value entered in inserted cell)

  5. #5
    Insomniac53
    Guest

    Re: Autosum after Insert Row

    Thanks Arthurbr. I'm using 2010 so the menu route is different. I had a quick look at Excel Options but haven't seen anything similar. Maybe someone with 2010 can tell us the setting, if there is one?

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,243

    Re: Autosum after Insert Row

    =A11+B11+C11, and this one updates correctly to =A12+B12+C12
    That's just the way Excel works. The formulas are all relative to the current row and change as required.

    Regards

+ 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