+ Reply to Thread
Results 1 to 5 of 5

Thread: Average a range based on criteria

  1. #1
    Registered User
    Join Date
    08-23-2011
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    91

    Average a range based on criteria

    Hi,

    I’m looking for a way to average a range of data based on criteria. I’ve attached an example worksheet (2007).

    The result being that if the formula looked for “Test1” then it would return 25.7 (as the blue highlighted cells average 27.5).

    I tried the below (inputting with CSE) but for some reason it gives me 9.7?!

    =AVERAGE(IF(A:A="Test1",B:F ))
    Attached Files Attached Files
    Last edited by Plumby; 02-14-2012 at 06:13 AM.

  2. #2
    Forum Moderator daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2007
    Posts
    10,057

    Re: Average a range based on criteria

    That formula will treat the blank cells as zero and distort the average. You can add another "clause" to filter out blanks, e.g.

    =AVERAGE(IF(A2:A6="Test1",IF(B2:F6<>"",B2:F6)))

    confirmed with CTRL+SHIFT+ENTER

    Note: that will include any zeroes but not blanks. if you want to exclude zeroes too then change "" to 0
    Audere est facere

  3. #3
    Registered User
    Join Date
    08-23-2011
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    91

    Re: Average a range based on criteria

    Thanks ever so much DDL! Thats very quick and works perfectly! May I ask - what does this bit do (trying to learn)

    <>""

    I shall mark it as solved, etc.

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    6,220

    Re: Average a range based on criteria

    ="" Equal to blank
    <>"" not equal to blank
    "Relax. What is mind? No matter. What is matter? Never mind!"

  5. #5
    Registered User
    Join Date
    08-23-2011
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    91

    Re: Average a range based on criteria

    Top man! Thank you.

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