+ Reply to Thread
Results 1 to 5 of 5

Sum x number of rows excluding some

  1. #1
    Registered User
    Join Date
    07-30-2014
    Location
    London
    MS-Off Ver
    2010
    Posts
    1

    Sum x number of rows excluding some

    Hi everyone,

    I have a very large data set where I need to sum the rows but exclude some so for example sum 1:100 but miss out every 20th row. This should give me the sum from 1 to 100 and miss out rows 20,40,60,80 and 100.

    Any help would be greatly appreciated.

    Thanks

    Reem

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Sum x number of rows excluding some

    Is there any other factor that could be used to 'flag' which cells should NOT be summed?
    Like if column A it has text "Subtotal" then don't include that row ?

  3. #3
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Sum x number of rows excluding some

    This arrayed formula will work

    =SUM(A1:A100*(MOD(ROW(A1:A100),20)>0))
    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.
    Does that work for you?

    or non-arrayed

    =SUMPRODUCT((A1:A100), --(MOD(ROW(A1:A100),20)>0))
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Sum x number of rows excluding some

    =SUMPRODUCT(--(MOD(ROW(A1:A100),20)<>0),A1:A100) will do that
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  5. #5
    Registered User
    Join Date
    03-06-2011
    Location
    chennai
    MS-Off Ver
    Excel 2016
    Posts
    46

    Re: Sum x number of rows excluding some

    Welcome reem,

    Assuming Column A:A contains values, then in Cell B1 =IF(IF(MOD(ROW(A1),20),0,1)=0,A1,0)
    and drag it down. Refer Sample attachment.
    Attached Files Attached Files

+ 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. [SOLVED] Count the number of cells over 35 days excluding rows/cells that have a "yes" value
    By northcoms in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-02-2013, 10:25 AM
  2. [SOLVED] Display the MAX number in a column excluding rows which have "yes" in another column
    By northcoms in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-01-2013, 08:00 AM
  3. Excluding Rows
    By WGN in forum Excel General
    Replies: 0
    Last Post: 10-17-2011, 03:10 PM
  4. How can I do number series excluding the hidden rows?
    By Maryam in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 10-16-2008, 01:57 AM
  5. [SOLVED] Finding MAX number (excluding a particular number)
    By Johnny in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-24-2005, 08:07 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