+ Reply to Thread
Results 1 to 3 of 3

Sumif function for non consecutive cells in sum and criteria

  1. #1
    Registered User
    Join Date
    07-13-2011
    Location
    Aurora
    MS-Off Ver
    Excel 2007
    Posts
    2

    Sumif function for non consecutive cells in sum and criteria

    I'm having issues figuring out how to setup a sumif function with a range that is not consecutive. For each day we have a new column, so setting up a named range is not optimal, a formula that could essentially be cut and pasted to each new day would be the only solution that would save any time.

    I need to add cells EK6, EK11, EK16, EK21...EK56, EK61 if they have a value of 2 in the cell above it, being EK5, EK10, EK15, EK20...EK55, EK60 respectively. Is there any way to setup a reusable formula to accomplish this task?

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Sumif function for non consecutive cells in sum and criteria

    This regular formula sums according to the rules you posted:
    =SUMPRODUCT((MOD(ROW(EK5:EK60),5)=0)*(EK5:EK60=2),EK6:EK61)

    EDITED TO INCLUDE THESE ADDITIONAL COMMENTS:
    While playing around some more, I came up with another (though, not necessarily better) regular-formula alternative:
    =SUM(SUMIF(OFFSET(E5,{0,5,10,15,20,25,30,35,40,45,50,55},0),2,OFFSET(E6,{0,5,10,15,20,25,30,35,40,45,50,55},0)))
    Note that there are a couple concerns to be aware of with that formula
    • the OFFSET function is volatile, so it recalculates whenever any cell in the workbook recalcs
    • Due to the hard-coding of offset values, it's only practical if there are a relative few referenced ranges

    Is that something you can work with?
    Last edited by Ron Coderre; 07-13-2011 at 01:17 PM.
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Registered User
    Join Date
    07-13-2011
    Location
    Aurora
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Sumif function for non consecutive cells in sum and criteria

    That did the trick. Thank you sir.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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