+ Reply to Thread
Results 1 to 6 of 6

Conditional sum

  1. #1
    Andreas Håkansson
    Guest

    Conditional sum

    Hi

    I want to add the values of a column but only for the rows that are marked
    with an x in the adjacent column. Like this

    A B
    1 x
    2
    3 x
    4 x
    5

    and it should sum up to 8. How would I contruct a function like this ?



  2. #2
    Andreas Håkansson
    Guest

    Re: Conditional sum

    Sorry

    Missd one vital point. I should ONLY include a row in the sum if the
    adjacent column contains an x AND the value in the column is larger then 1.
    So there's two conditions that has to be matched otherwise it would be a
    sum.if


    "Andreas Håkansson" <[email protected]> skrev i meddelandet
    news:[email protected]...
    > Hi
    >
    > I want to add the values of a column but only for the rows that are marked
    > with an x in the adjacent column. Like this
    >
    > A B
    > 1 x
    > 2
    > 3 x
    > 4 x
    > 5
    >
    > and it should sum up to 8. How would I contruct a function like this ?
    >




  3. #3
    Biff
    Guest

    Re: Conditional sum

    Hi!

    Try this:

    =SUMPRODUCT(--(A1:A5>1),--(B1:B5="x"),A1:A5)

    Biff

    "Andreas Håkansson" <[email protected]> wrote in message
    news:[email protected]...
    > Hi
    >
    > I want to add the values of a column but only for the rows that are marked
    > with an x in the adjacent column. Like this
    >
    > A B
    > 1 x
    > 2
    > 3 x
    > 4 x
    > 5
    >
    > and it should sum up to 8. How would I contruct a function like this ?
    >




  4. #4
    Forum Contributor
    Join Date
    08-28-2005
    Posts
    301

    conditional sum!

    =SUMIF(B:B,"x",A:A)

    -via135



    Quote Originally Posted by Andreas Håkansson
    Hi

    I want to add the values of a column but only for the rows that are marked
    with an x in the adjacent column. Like this

    A B
    1 x
    2
    3 x
    4 x
    5

    and it should sum up to 8. How would I contruct a function like this ?

  5. #5
    Andreas Håkansson
    Guest

    Re: Conditional sum

    Thanks!

    "Biff" <[email protected]> skrev i meddelandet
    news:[email protected]...
    > Hi!
    >
    > Try this:
    >
    > =SUMPRODUCT(--(A1:A5>1),--(B1:B5="x"),A1:A5)
    >
    > Biff
    >
    > "Andreas Håkansson" <[email protected]> wrote in message
    > news:[email protected]...
    >> Hi
    >>
    >> I want to add the values of a column but only for the rows that are
    >> marked with an x in the adjacent column. Like this
    >>
    >> A B
    >> 1 x
    >> 2
    >> 3 x
    >> 4 x
    >> 5
    >>
    >> and it should sum up to 8. How would I contruct a function like this ?
    >>

    >
    >




  6. #6
    Biff
    Guest

    Re: Conditional sum

    You're welcome!

    Biff

    "Andreas Håkansson" <[email protected]> wrote in message
    news:u%[email protected]...
    > Thanks!
    >
    > "Biff" <[email protected]> skrev i meddelandet
    > news:[email protected]...
    >> Hi!
    >>
    >> Try this:
    >>
    >> =SUMPRODUCT(--(A1:A5>1),--(B1:B5="x"),A1:A5)
    >>
    >> Biff
    >>
    >> "Andreas Håkansson" <[email protected]> wrote in message
    >> news:[email protected]...
    >>> Hi
    >>>
    >>> I want to add the values of a column but only for the rows that are
    >>> marked with an x in the adjacent column. Like this
    >>>
    >>> A B
    >>> 1 x
    >>> 2
    >>> 3 x
    >>> 4 x
    >>> 5
    >>>
    >>> and it should sum up to 8. How would I contruct a function like this ?
    >>>

    >>
    >>

    >
    >




+ 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