+ Reply to Thread
Results 1 to 9 of 9

ignore empty data across a range

  1. #1
    Registered User
    Join Date
    07-09-2009
    Location
    Michigan, USA
    MS-Off Ver
    Excel 2003
    Posts
    11

    ignore empty data across a range

    I'd like to compute the average of a few numbers, but only if the data has a certain number of non-null values. I've attached my Excel sheet for reference.

    I have relevant data in columns B and D, where B represents a day and D represents temperature. I'd like to average the temperatures together for each day and place the result in column E. However, this must be done only if each day has at least 22 non-null values (null values are represented by -9999).

    A perfect example is day 296 - my average is thrown completely off by the existence of several null values in the last half of the day.

    In addition to the problem above, I'd also like to only compute the average using the non-null values (ie, if a day has 23 non-null values and 1 null value, I want to ignore the null value in the average calculation - see day 222 as an example).

    Thanks in advance for the help!
    Attached Files Attached Files
    Last edited by ruberg; 07-24-2009 at 01:13 PM. Reason: solved

  2. #2
    Registered User
    Join Date
    07-09-2009
    Location
    Michigan, USA
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: ignore empty data across a range

    Attached is better version of my spreadsheet, with the beginnings of the formula I'm trying to create.

    Please Login or Register  to view this content.
    This solves most of the problem... however I would like for the range in COUNTIF to be dynamic depending on the corresponding day number.
    Attached Files Attached Files

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: ignore empty data across a range

    with helper columns to give days 1-365 col f and one to count non null values col g then use averageif as in col e (note its an array formula confirmed with ctrl+shift+enter)
    if you dont want the extra column g
    use
    =IF(SUMPRODUCT(--(B1:B8760=F1),--(D1:D8760<>-9999))>21,AVERAGE(IF(B1:B8760=F1,D1:D8760)),"less than 22 non null values") in col e instead (again array entered)
    see my sig on how to enter arrays
    Attached Files Attached Files
    Last edited by martindwilson; 07-23-2009 at 07:53 AM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Registered User
    Join Date
    07-09-2009
    Location
    Michigan, USA
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: ignore empty data across a range

    Great, that's very helpful; thank you! However, I've encountered one strange problem: the formula works - clicking the "fx" button brings up the "function arguments" window and the result is correct. However, in the cell it shows up as a zero. Any ideas on what could be wrong? I've tried changing the formatting and extending the width of the column, but neither works.

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: ignore empty data across a range

    does f9 make it work

  6. #6
    Registered User
    Join Date
    07-09-2009
    Location
    Michigan, USA
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: ignore empty data across a range

    No, F9 does not make it work.

    What is F9 supposed to do?

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: ignore empty data across a range

    f9 recalulates
    perhaps you should try copying the whole lot to a new work sheet.
    i have seen this happen before and cant for the life of me remember how i cured it.

  8. #8
    Registered User
    Join Date
    07-09-2009
    Location
    Michigan, USA
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: ignore empty data across a range

    Recopying to a new worksheet doesn't work either.

    Thanks for the assistance anyway! I'll search the forums for this strange zero problem.

  9. #9
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: ignore empty data across a range

    to recalculate
    Люди, питающие благие намерения, как раз и становятся чудовищами.

    Regards, ?Born in USSR?
    Vusal M Dadashev

    Baku, Azerbaijan

+ 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