+ Reply to Thread
Results 1 to 3 of 3

Summing in groups based on specific criteria

  1. #1
    Registered User
    Join Date
    04-04-2011
    Location
    Amersfoort
    MS-Off Ver
    Excel 2003
    Posts
    9

    Summing in groups based on specific criteria

    Hey there, I ran into this forum and wanted to ask a question!
    I got a question about flexible sommations.

    Lets say I have clusters of the following format;

    K_____________ N
    11144_____________ 192
    111555767_____________1,78
    WE11231_____________ 63,8
    WE123123_____________1620
    EW12312_____________ 2
    RR123____________1590
    DC11112231_____________
    ABa123123_____________
    AOW123123123_____________
    DC9988 _____________

    The amount of lines between two DCxxxx numbers can fluctuate between 1 and 99, codes in column K are unique. K and N are vital.

    If a line starts with DC, the lines below are part of the DC ( in the example DC11111A)
    group untill a new DCxx ( in the example DC11112231) comes up. Then the following lines will be the base of the new DC number (DC11112231).

    How can I make it cluster the lines, giving a sommation for each DC number?

    ultimatly displaying;

    DC11111A 3469,58
    DC11112231 0
    DC9988 0

    Thanks in advance for any support!
    Last edited by NBVC; 04-06-2011 at 10:58 AM.

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

    Re: Question about sommations

    Your sample does not show a DC11111A.... but assuming your data is in K2:K11 and N2:N11

    then in a new column at row 2 enter:

    =IF(LEFT(K2;2)="DC";SUM(N2:INDEX(N3:N$11;MATCH("DC*";K3:K$11;0)));"")

    copied down.

    If you want to consolidate then in another new column enter:

    =LOOKUP(REPT("z";255);CHOOSE({1;2};"";INDEX($K$2:$K$11;SMALL(IF(ISNUMBER($O$2:$O$11);ROW($K$2:$K$11)-ROW($K$2)+1);ROWS($A$1:$A1)))))

    where O2:O11 is where you put the first formula. Then confirm this formula with CTRL+SHIFT+ENTER not just ENTER and copy down.

    Then in next column, assuming you put the above formula in Q2 down.

    =IF(Q2="";"";SUMIF($K$2:$K$11;Q2;$O$2:$O$11))

    copied down.

    You may need to translate the functions.....
    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
    04-04-2011
    Location
    Amersfoort
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Question about sommations

    I am sorry for the late reply, but it works like a charm! Awesome that you took the time and effort to help me out!
    Last edited by NBVC; 04-06-2011 at 10:39 AM. Reason: Deleted quote of whole post

+ 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