+ Reply to Thread
Results 1 to 13 of 13

SUMIF with dynamic criteria

  1. #1
    Forum Contributor
    Join Date
    09-19-2007
    Posts
    115

    SUMIF with dynamic criteria

    i'm hoping someone will be able to assist me with my SUMIF problem.

    i've attached my sample worksheet and formula yet it's sadly incorrect.

    what i'd like to do is, display the results as detailed in rows 13 to 16, being a summary of rows 2 to 10. i have a worksheet that contains 1600 lines of account codes, some repeated, and 250 columns. when an account is repeated in a column, it will only have one instance of data. yet where it is the second instance, a INDEX/MATCH simple stops at the first instance, so where it is 0, it's detailed as 0 yet actually has results (eg P2, P3, P5).

    i believe a SUMIF is appropriate as it will add all the instances in a column (as suggested by the formula in C14), with only having to define a few ranges, yet the formula I have tried (B18) returns 0.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606
    Please see a couple of different approaches in the attached file.
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    09-19-2007
    Posts
    115
    thanks for the suggestions Stephen, yet i can't use a SUMPRODUCT nor a pivot table. there are 1600 account lines and 250 columns, and i simply can't define each. this formula needs to be used across 10-15 worksheets all referencing the same data source.

    i've seen this lookup done with a SUMIF and dynamic ranges/criteria yet i can't seem to understand the process and the SUMIF doesn't resolve neatly like a SUMPRODUCT does.

    please don't think i'm ungrateful for your suggestions or contribution, more frustrated by excel!

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Does this work for you?

    Please Login or Register  to view this content.
    copied down and across.
    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.

  5. #5
    Forum Contributor
    Join Date
    09-19-2007
    Posts
    115
    it does! thanks NBVC, you're a handy smurf!!

    can i ask how the INDEX/MATCHs comprise the SUMIF range,criteria and sum_range format? that's the bit i don't understand as the formula doesn't resolve nicely.

  6. #6
    Forum Contributor
    Join Date
    09-19-2007
    Posts
    115
    oh, and another question if it's ok, in the INDEX i notice you're detailed the first and last rows of the range "2" and "10".

    what if the last row of the range was unknown? could you include an OFFSET function to determine the "10" in the second INDEX function and use a named dynamic range for "A2:A10" etc?

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    As long as you put your summaries on the side and you don't have other non-relevant data below your database...then you can use this formula to make the last row dynamic (see attached):

    Please Login or Register  to view this content.
    To understand the formula, try performing a formula audit by going to Tools|Formula Auditing|Evaluate Formula and then keep clicking Evaluate to step through the evaluation process...

    If you still have specific questions, please post them back.

    Hope this helps

  8. #8
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606
    No problem, I should have read your question properly. Looks like you're sorted now but not completely sure why SUMPRODUCT wouldn't work.

  9. #9
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Actually, revisiting my last post, I realized, there are more places you need to add the end row dynamic finding.....

    changed the formula to:

    Please Login or Register  to view this content.
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    09-19-2007
    Posts
    115
    thanks NBVC. i'll try that today.

  11. #11
    Forum Contributor
    Join Date
    09-19-2007
    Posts
    115
    NBVC, i just wanted to say thanks for pointing me in the right direction with your formula.

    since i could follow your suggestion, and it seemed to resolve better than some other SUMIF solutions i've seen on the net i was able to figure out how to apply it to my actual situation.

  12. #12
    Forum Contributor
    Join Date
    09-19-2007
    Posts
    115

    anomoly in formula

    happy new year everyone!

    i guess 2008 continues to bring us all Excel questions...

    i've discovered an issue in the attached formula and can't seem to resolve it. to refresh, what needs to occur is as follows. data is contained in the range A1:G12. this needs to be summarised into groups as suggested by range A15:G18. not all "Ps" will be present in the data range, yet all Ps are mapped to their higher level Group in range A22:B28.

    yet in the attached suggestion i can not see how the formula refers to the headings in Row 1? Also, there are no "P" items allocated to Group3 yet there are summary results. similarly Group4 should equal the P4 items yet it equals the P7 items.

    can anyone help?
    Attached Files Attached Files

  13. #13
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Inky, I think you added this post to the wrong thread....the topic and results in this thread are not reflected in your attachment....

    I think you meant to add to this thread of yours....

    http://www.excelforum.com/showthread.php?t=626598

+ 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