+ Reply to Thread
Results 1 to 7 of 7

AVERAGEIF: can't get around #DIV/0! error

  1. #1
    Registered User
    Join Date
    07-04-2012
    Location
    Galway, Ireland
    MS-Off Ver
    Excel 2003
    Posts
    4

    AVERAGEIF: can't get around #DIV/0! error

    Hi.

    Forum noob here. Please be gentle.

    I'm trying to get the arithmetic mean of a selection of numbers from a list of 100 values.

    It's a survey of free speeds (motor traffic) and the complete list of numbers comprises 100 speed readings in kilometres per hour.

    The speed limit on the road in question is 50 km/h, so I am trying to obtain (using AVERAGEIF) the mean speed of 'speeders'.

    In other words, I want to calculate the average of all the readings greater than 50.

    The data are in cells B24:B123, worksheet "Readings".

    The reference value (in this instance 50 km/h) is in the user defined variable "speedlimit".

    This is the formula I am using, and which gives the #DIV/0! error: =AVERAGEIF(Readings!B24:B123,">speedlimit")

    I've tried various tweaks, but I always get the same error.

    What am I doing wrong, and how can I fix it?

    Thanks in advance.




    EDIT: Incidentally, if I use =AVERAGEIF(Readings!B24:B123,">50") it works fine. However, I need to be able to have different values for the variable "speedlimit".
    Last edited by dadowai; 07-04-2012 at 03:05 PM.

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

    Re: AVERAGEIF: can't get around #DIV/0! error

    Perhaps:

    =AVERAGEIF(Readings!B24:B123,">"&speedlimit)
    Where there is a will there are many ways.

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

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

  3. #3
    Registered User
    Join Date
    07-04-2012
    Location
    Galway, Ireland
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: AVERAGEIF: can't get around #DIV/0! error

    Posted twice by accident. Can't delete, hence edit.
    Last edited by dadowai; 07-04-2012 at 03:13 PM.

  4. #4
    Registered User
    Join Date
    07-04-2012
    Location
    Galway, Ireland
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: AVERAGEIF: can't get around #DIV/0! error

    Quote Originally Posted by NBVC View Post
    Perhaps:

    =AVERAGEIF(Readings!B24:B123,">"&speedlimit)


    Bingo!

    Worked a treat. Many thanks. Answer is 63, by the way. :-)

    Now, I have to ask: why is it necessary to put > in "", and why the & before the variable speedlimit?

    There is no clue at all in Excel help about these crucial details, AFAICS.
    Last edited by dadowai; 07-04-2012 at 03:14 PM.

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: AVERAGEIF: can't get around #DIV/0! error

    because you are making a reference to a specific cell or named range, you need to keep that outside the quotes, which would make it assume the named range is a text string....

  6. #6
    Registered User
    Join Date
    07-04-2012
    Location
    Galway, Ireland
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: AVERAGEIF: can't get around #DIV/0! error

    The "" around the > looks very counterintuitive to me, even though it is obviously correct.

    What is the significance of the & before the variable speedlimit?

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: AVERAGEIF: can't get around #DIV/0! error

    It's just the way these functions (SUMIF, COUNTIF, AVERAGEIF, etc) were designed... the operator and any text strings or numbers are entered between quotes... any references to cells, named ranges need to be split out from the quotes to indicate that they themselves aren't text strings, the & concatenates the operator with the criteria argument...

+ 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