+ Reply to Thread
Results 1 to 6 of 6

applying function depending on condition in other cell

Hybrid View

Guest applying function depending... 04-21-2005, 06:06 AM
Guest RE: applying function... 04-21-2005, 08:06 AM
Guest Re: applying function... 04-21-2005, 08:06 AM
Guest Re: applying function... 04-21-2005, 09:06 AM
Guest Re: applying function... 04-21-2005, 11:06 AM
Guest Re: applying function... 04-21-2005, 09:06 AM
  1. #1
    jonnegoogle@yahoo.com
    Guest

    applying function depending on condition in other cell

    Hi experts,

    If I have data like this

    A B
    -------------
    x 2
    x 5
    y 6
    x 1
    y 2
    x 3

    How do I include the values of column B in a function, only if the
    values have a corresponding x in the A column. For example if I would
    like to calculate the AVERAGE only of the values in B which has the
    value X in A.

    Jonas


  2. #2
    Toppers
    Guest

    RE: applying function depending on condition in other cell

    Try:

    Assumes data is in range a1 to b10

    =Sumif(a1:a10,"x",b1:b10)/countif(a1:a10,"x")

    HTH

    "jonnegoogle@yahoo.com" wrote:

    > Hi experts,
    >
    > If I have data like this
    >
    > A B
    > -------------
    > x 2
    > x 5
    > y 6
    > x 1
    > y 2
    > x 3
    >
    > How do I include the values of column B in a function, only if the
    > values have a corresponding x in the A column. For example if I would
    > like to calculate the AVERAGE only of the values in B which has the
    > value X in A.
    >
    > Jonas
    >
    >


  3. #3
    jonnegoogle@yahoo.com
    Guest

    Re: applying function depending on condition in other cell

    Great! Thanks a lot, I've always thought there was a smarter way to do
    this than using only the "if"-statement and several new columns of
    space, but I never new about "sumif" and "countif".
    This is of course very appropriate for simple things as summing or
    averaging, but is there also a more general way to do similar things
    for an arbitrary function?

    Jonas, very gratetful for the quick answer!


  4. #4
    Bob Phillips
    Guest

    Re: applying function depending on condition in other cell

    My solution shows you that.

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    <jonnegoogle@yahoo.com> wrote in message
    news:1114084140.684205.32870@z14g2000cwz.googlegroups.com...
    > Great! Thanks a lot, I've always thought there was a smarter way to do
    > this than using only the "if"-statement and several new columns of
    > space, but I never new about "sumif" and "countif".
    > This is of course very appropriate for simple things as summing or
    > averaging, but is there also a more general way to do similar things
    > for an arbitrary function?
    >
    > Jonas, very gratetful for the quick answer!
    >




  5. #5
    jonnegoogle@yahoo.com
    Guest

    Re: applying function depending on condition in other cell

    Thanks!
    Today is a very nice day, never heard about array formulas before.
    Seems extremely useful.

    Jonas


  6. #6
    Bob Phillips
    Guest

    Re: applying function depending on condition in other cell

    or

    =AVERAGE(IF(A1:A10="x",B1:B10))

    which is an array formula, so is committed with Ctrl-Shift-Enter

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Toppers" <Toppers@discussions.microsoft.com> wrote in message
    news:2A783AB9-31A7-4354-9C5C-400BE0E51774@microsoft.com...
    > Try:
    >
    > Assumes data is in range a1 to b10
    >
    > =Sumif(a1:a10,"x",b1:b10)/countif(a1:a10,"x")
    >
    > HTH
    >
    > "jonnegoogle@yahoo.com" wrote:
    >
    > > Hi experts,
    > >
    > > If I have data like this
    > >
    > > A B
    > > -------------
    > > x 2
    > > x 5
    > > y 6
    > > x 1
    > > y 2
    > > x 3
    > >
    > > How do I include the values of column B in a function, only if the
    > > values have a corresponding x in the A column. For example if I would
    > > like to calculate the AVERAGE only of the values in B which has the
    > > value X in A.
    > >
    > > Jonas
    > >
    > >




+ 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