+ Reply to Thread
Results 1 to 6 of 6

Thread: AVERAGE with IF statement

  1. #1
    Registered User
    Join Date
    06-10-2010
    Location
    Berkshire, England
    MS-Off Ver
    Excel 2007
    Posts
    35

    AVERAGE with IF statement

    Hope somebody can quickly aid me on this one. Having a memory blank.
    Please see attached example.


    I wish to calculate the AVERAGE of a list of 'VALUE' of each 'TYPE'

    e.g. IF 'TYPE' = 'A', then AVERAGE 'VALUE' = n

    So I need to combine the above statement in one cell to apply in the example I've given.

    Thanks,

    Ben.
    Attached Files Attached Files

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

    Re: AVERAGE with IF statement

    Try:

    =SUMIF($A$2:$A$17,D2,$B$2:$B$17)/COUNTIF($A$2:$A$17,D2)

    where D2 contains just A or B or C...
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  3. #3
    Registered User
    Join Date
    06-10-2010
    Location
    Berkshire, England
    MS-Off Ver
    Excel 2007
    Posts
    35

    Re: AVERAGE with IF statement

    Thanks for the ultra-quick response. I had forgotten that there is an 'AVERAGEIF' function that works in exactly the same manner as 'SUMIF'.

    Is there also a 'MAXIF' function to find the 'MAX' of a range of values to work in the same fashion?

  4. #4
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: AVERAGE with IF statement

    By your profile and attachment, I figured you were not using 2003, so that is why I did not mention AVERAGEIF.

    There is no MAXIF function, however...

    You would need an array formula:

    =MAX(IF($A$2:$A$17=D2,$B$2:$B$17))

    confirmed with CTRL+SHIFT+ENTER not just ENTER
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  5. #5
    Registered User
    Join Date
    06-10-2010
    Location
    Berkshire, England
    MS-Off Ver
    Excel 2007
    Posts
    35

    Re: AVERAGE with IF statement

    Genius! Thanks for that.

    Why does the confirmation of CTRL+SHIFT+ENTER come into play on this when a normal 'ENTER' doesn't confirm the function?

    Ben.

  6. #6
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: AVERAGE with IF statement

    Because it is considered an Array formula.
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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.2.0