+ Reply to Thread
Results 1 to 18 of 18

Perform sum even after deleting some rows from a sum range

  1. #1
    Forum Contributor
    Join Date
    09-04-2007
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    133

    Perform sum even after deleting some rows from a sum range

    Hi,

    I have a multiple range of data which is not continuous and performed sum of the multiple range. Now, i would like to delete some rows which are not needed anymore but it throws an #REF! error. Is there a way around it? by which i mean, can i perform sum without throwing errors even after some rows within multiple range are deleted

    Thanks,

    Kon.
    Last edited by skonduru; 03-30-2016 at 04:09 PM.

  2. #2
    Forum Contributor
    Join Date
    09-04-2007
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    133

    Re: Perform sum even after deleting some rows from a sum range

    Can anyone help me with this please?

  3. #3
    Valued Forum Contributor
    Join Date
    01-16-2012
    Location
    England
    MS-Off Ver
    MS 365
    Posts
    1,397

    Re: Perform sum even after deleting some rows from a sum range

    skonduru,

    Haven't tested this, but If you "name" your range of non-continuous cells, this might work?.

    =IF(ISNUMBER(your formula here),your formula here,"")

    Or alternatively:

    =SUMIF(yourrange,">=0")+SUMIF(yourrange,"<0")

    Either of those should ignore all cells with errors, text and the like.

    Ochimus

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Perform sum even after deleting some rows from a sum range

    Post your formula.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Forum Contributor
    Join Date
    09-04-2007
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    133

    Re: Perform sum even after deleting some rows from a sum range

    Thanks Ochimus and Tony..

    Currently, i am just using

    =SUM(K45:K51)+SUM(K54:K60)+SUM(K63:K81)+SUM(K84:K87)+SUM(K90:K93).

    I would like user to delete rows 83 to 94 which will throw #REF! error. Even after deleting i would like to perform addition of remaining cells without giving error.

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Perform sum even after deleting some rows from a sum range

    Try it like this...

    =SUM(K45:K51,K54:K60,K63:K81,INDIRECT("K84:K87"),INDIRECT("K90:K93"))

  7. #7
    Forum Contributor
    Join Date
    09-04-2007
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    133

    Re: Perform sum even after deleting some rows from a sum range

    Thanks Tony.

    But if i use indirect function, it will make those references constant, instead i would to have those references as dynamic.

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Perform sum even after deleting some rows from a sum range

    Quote Originally Posted by skonduru View Post
    i would to have those references as dynamic.
    Not sure what you mean by that.

    If you delete the rows then what should happen to those ranges in the formula?

    =SUM(K45:K51,K54:K60,K63:K81,K84:K87,K90:K93)

  9. #9
    Forum Contributor
    Join Date
    09-04-2007
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    133

    Re: Perform sum even after deleting some rows from a sum range

    The highlighted ranges will become #REF! s, is there a way to force sum to ignore those errors?

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Perform sum even after deleting some rows from a sum range

    The only way I know how to do it is by using INDIRECT.

  11. #11
    Forum Contributor
    Join Date
    09-04-2007
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    133

    Re: Perform sum even after deleting some rows from a sum range

    Ok. Thanks Tony.

    Can anyone else help me with this issue?

  12. #12
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Perform sum even after deleting some rows from a sum range

    Let me post this in our "Need help with this" section.

  13. #13
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: Perform sum even after deleting some rows from a sum range

    What is in the "in between" cells (K52 and K53 for example) that makes it undesirable to use =SUM(K45:K93)? With a single range in your sum function, Excel will update the range without the range-ref errors when you delete or insert rows. As you have it, you get these errors whenever you delete all of the rows associated with one of the SUM() functions. Any solutions I see to this involve getting rid of the "piecemeal" summation and make a single "sum" range. Exactly how I would do that depends on what is in those "in between" rows.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  14. #14
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Perform sum even after deleting some rows from a sum range

    Quote Originally Posted by Tony Valko View Post
    The only way I know how to do it is by using INDIRECT.
    It could also be done with OFFSET but the net result is the same.

    After the rows are deleted the data is deleted but the deleted ranges are still evaluated ("active").

  15. #15
    Forum Contributor
    Join Date
    09-04-2007
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    133

    Re: Perform sum even after deleting some rows from a sum range

    Thanks for your input MrShorty.

    I have sub totals in between K52 and K53 which i dont want to include when performing grand total of all subtotals.

  16. #16
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: Perform sum even after deleting some rows from a sum range

    Is it necessary for the subtotals to be in column K? Could they be moved over to column L? If the subtotals are in their own column, then the grand total can either be the sum of column K or the sum of column L?

    Is it necessary to exclude the subtotal cells from the grand total? Including the subtotals in the grand total would mean "doubling" the result (since each value effectively gets counted twice). Dividing by 2 should correct for the double inclusion. =sum(K45:K93)/2

    Is there some indicator in another column that could be used in a =SUMIF() or SUMIFS() function to pick out the values to include in the grand total? If something like "subtotal" is in column J where the subtotals are, then you could use =SUMIF(J45:J93,"subtotal",K45:K93).

    I'm sure there are a lot of different options. Like I indicated above, all the options that I would put forth involve some strategy for getting rid of the "piecemeal" way you are currently defining the sum range and make the sum range a single block of cells.

  17. #17
    Forum Contributor
    Join Date
    09-04-2007
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    133

    Re: Perform sum even after deleting some rows from a sum range

    Hi MrShorty, SumIF strategy seems like a way to go.

    Appreciate your help alot.

    Kon

  18. #18
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,723

    Re: Perform sum even after deleting some rows from a sum range

    Going back to the formula you posted in Post #5, i.e.:

    =SUM(K45:K51)+SUM(K54:K60)+SUM(K63:K81)+SUM(K84:K87)+SUM(K90:K93)

    you could change this to:

    =IFERROR(SUM(K45:K51),0)+IFERROR(SUM(K54:K60),0)+IFERROR(SUM(K63:K81),0)+IFERROR(SUM(K84:K87),0)+IFERROR(SUM(K90:K93),0)

    and if you then deleted rows 83 to 94 that would then change to:

    =IFERROR(SUM(K45:K51),0)+IFERROR(SUM(K54:K60),0)+IFERROR(SUM(K63:K81),0)+IFERROR(SUM(#REF!),0)+IFERROR(SUM(#REF!),0)

    but it would still return a result of the sum of the first 3 ranges.

    Hope this helps.

    Pete

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Deleting rows in between a named range
    By shanecb in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-06-2013, 12:15 PM
  2. deleting rows with interval (dynamic range)
    By flunzy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-23-2013, 08:24 AM
  3. Deleting duplicates in a range of rows
    By Mkkl in forum Excel General
    Replies: 7
    Last Post: 04-16-2013, 06:18 AM
  4. Deleting all rows that don't fit criteria range in a column
    By oenleunc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-04-2012, 07:39 PM
  5. Deleting rows containing zero within specified range
    By NewbieVBA in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-04-2011, 02:27 PM
  6. Deleting range of rows in subroutine loop
    By driffert in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-09-2010, 01:49 PM
  7. Deleting Rows using a range in Column A
    By leskoby in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-28-2005, 09:22 PM
  8. deleting range of rows if ..
    By travist in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-03-2005, 06:01 AM

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