+ Reply to Thread
Results 1 to 3 of 3

Limited Sumif

  1. #1
    Maarten
    Guest

    Limited Sumif

    Hello all,
    I am looking for a kind of Sumif function to sum the values in column A if
    the conditions in column B are OK. BUT the range should be limited. Sumif
    sums all the values in the range which match a condition, while I am looking
    for some function which limits the range (as specified). In the example
    below, when you drop down from C1, the values from column A should be summed
    in column C once you reach the first '1' for all B's=0, but only for the
    previous 'block' of zeros. I hope the example makes it a bit more clear.
    A B C
    0,1 0 0
    0,1 0 0
    0,1 0 0
    0,1 1 0,3 (=sum A1-A3)
    0,1 1 0
    0,1 1 0
    0,1 0 0
    0,1 0 0
    0,1 0 0
    0,1 0 0
    0,1 1 0,4 (=sum A7-A10)
    ....
    thanks!
    Maarten

  2. #2
    Aladin Akyurek
    Guest

    Re: Limited Sumif

    Let A1:B15 house:

    {"X",1;
    0.1,0;
    0.1,0;
    0.1,0;
    0.1,1;
    0.1,1;
    0.1,1;
    0.1,0;
    0.1,0;
    0.1,0;
    0.1,0;
    0.1,1;
    0.1,1;
    0.1,0;
    0.1,0}

    On you system, a value like 0.1 is 0,1.
    Note that A1:B1 houses: X and 1. X is a label, while 1 is required.
    Suppose that you have a label in B1, like Y. Replace Y with 1 and custom
    format B1 as:

    [=1]"Y";General

    Now B1 will display Y but it will house 1, which is needed by the
    formula in C2 that follows...

    C2:

    =IF((B1=0)*(B2=1),SUM(A1:INDEX($A$1:A1,MATCH(2,1/($B$1:B1=1))+1)),"")

    which you need to confirm with control+shift+enter (instead of just with
    enter) and copy down.

    Maarten wrote:
    > Hello all,
    > I am looking for a kind of Sumif function to sum the values in column A if
    > the conditions in column B are OK. BUT the range should be limited. Sumif
    > sums all the values in the range which match a condition, while I am looking
    > for some function which limits the range (as specified). In the example
    > below, when you drop down from C1, the values from column A should be summed
    > in column C once you reach the first '1' for all B's=0, but only for the
    > previous 'block' of zeros. I hope the example makes it a bit more clear.
    > A B C
    > 0,1 0 0
    > 0,1 0 0
    > 0,1 0 0
    > 0,1 1 0,3 (=sum A1-A3)
    > 0,1 1 0
    > 0,1 1 0
    > 0,1 0 0
    > 0,1 0 0
    > 0,1 0 0
    > 0,1 0 0
    > 0,1 1 0,4 (=sum A7-A10)
    > ...
    > thanks!
    > Maarten


  3. #3
    Maarten
    Guest

    Re: Limited Sumif

    It works fine, Thanks a lot!

    "Aladin Akyurek" wrote:

    > Let A1:B15 house:
    >
    > {"X",1;
    > 0.1,0;
    > 0.1,0;
    > 0.1,0;
    > 0.1,1;
    > 0.1,1;
    > 0.1,1;
    > 0.1,0;
    > 0.1,0;
    > 0.1,0;
    > 0.1,0;
    > 0.1,1;
    > 0.1,1;
    > 0.1,0;
    > 0.1,0}
    >
    > On you system, a value like 0.1 is 0,1.
    > Note that A1:B1 houses: X and 1. X is a label, while 1 is required.
    > Suppose that you have a label in B1, like Y. Replace Y with 1 and custom
    > format B1 as:
    >
    > [=1]"Y";General
    >
    > Now B1 will display Y but it will house 1, which is needed by the
    > formula in C2 that follows...
    >
    > C2:
    >
    > =IF((B1=0)*(B2=1),SUM(A1:INDEX($A$1:A1,MATCH(2,1/($B$1:B1=1))+1)),"")
    >
    > which you need to confirm with control+shift+enter (instead of just with
    > enter) and copy down.
    >
    > Maarten wrote:
    > > Hello all,
    > > I am looking for a kind of Sumif function to sum the values in column A if
    > > the conditions in column B are OK. BUT the range should be limited. Sumif
    > > sums all the values in the range which match a condition, while I am looking
    > > for some function which limits the range (as specified). In the example
    > > below, when you drop down from C1, the values from column A should be summed
    > > in column C once you reach the first '1' for all B's=0, but only for the
    > > previous 'block' of zeros. I hope the example makes it a bit more clear.
    > > A B C
    > > 0,1 0 0
    > > 0,1 0 0
    > > 0,1 0 0
    > > 0,1 1 0,3 (=sum A1-A3)
    > > 0,1 1 0
    > > 0,1 1 0
    > > 0,1 0 0
    > > 0,1 0 0
    > > 0,1 0 0
    > > 0,1 0 0
    > > 0,1 1 0,4 (=sum A7-A10)
    > > ...
    > > thanks!
    > > Maarten

    >


+ 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