+ Reply to Thread
Results 1 to 9 of 9

How to use SUMIF on consecutive cells matching criteria

  1. #1
    Registered User
    Join Date
    05-20-2009
    Location
    Encino, CA
    MS-Off Ver
    Excel 2003
    Posts
    30

    How to use SUMIF on consecutive cells matching criteria

    How would I write a sumif function to only add consecutive cells that match the criteria? Here is the formula I am using right now, but it adds all of the cells that match the criteria, not just the consecutive ones. Also they need to be consecutive cells from the current cell (in the formula below i would be referring to A80)

    =IF(A81<>A80,SUMIF(A$5:A80,A80,H$5:H80),"")

    More data:
    Column A is a group of dates, but not in order, they are slightly mixed up
    Column H is a monetary value.


    Thanks in advance
    Last edited by panamakevin; 05-29-2009 at 01:38 PM. Reason: NBVC solved the problem

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: How to use SUMIF on consecutive cells matching criteria

    Maybe better to post an actual workbook example showing some expected results...
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    05-20-2009
    Location
    Encino, CA
    MS-Off Ver
    Excel 2003
    Posts
    30

    Re: How to use SUMIF on consecutive cells matching criteria

    Here is an Example, I put notes in column K
    Attached Files Attached Files

  4. #4
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949

    Re: How to use SUMIF on consecutive cells matching criteria

    Eh, kinda hard to say without being able to see the sheet itself... but could you use a helper column to determine which cells meet the consecutive criteria, then sumif that helper column?
    =IF(AND(OR(BLONDE,BRUNETTE,REDHEAD),OR(MY PLACE,HER PLACE),ME),BOW-CHICKA-BOW-WOW,ANOTHER NIGHT ON THE INTERNET)

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: How to use SUMIF on consecutive cells matching criteria

    Does this in I5, copied down work?

    =IF(A6<>A5,IF(A4<>A5,H5,SUMIF(A$5:A5,A5,H$5:H5)),"")

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: How to use SUMIF on consecutive cells matching criteria

    Actually, probably, this one is more accurate:

    Please Login or Register  to view this content.
    confirmed with CTRL+SHIFT+ENTER and copied down..

  7. #7
    Registered User
    Join Date
    05-20-2009
    Location
    Encino, CA
    MS-Off Ver
    Excel 2003
    Posts
    30

    Re: How to use SUMIF on consecutive cells matching criteria

    Well it works for the groups but unfortunately its no longer giving me the 'interest by date' for the single, non-grouped dates. Looks like I get to learn a few new commands today (MATCH, INDEX) heh heh. Thanks as always NBVC

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: How to use SUMIF on consecutive cells matching criteria

    I am not sure what you mean.. see attached I put formula in column J..

    It seems to me they are summing in groups and/or individuals.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    05-20-2009
    Location
    Encino, CA
    MS-Off Ver
    Excel 2003
    Posts
    30

    Talking Re: How to use SUMIF on consecutive cells matching criteria

    Ok, So I got it working last night. I kept getting a reference error when i plugged it into column I so instead I threw it into column J like you had done and I just had I reference J then hid columns J & K. Thanks for the help again NBVC!!! I am getting a stronger and stronger grasp of this stuff. I just started learning VB last night, so I look forward to many more conversations regarding functions and programming...

+ 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