+ Reply to Thread
Results 1 to 17 of 17

Average of data excluding gaps

  1. #1
    Registered User
    Join Date
    07-26-2013
    Location
    Massachusetts
    MS-Off Ver
    Excel 2010
    Posts
    47

    Average of data excluding gaps

    Hey everyone,

    I have a spreadsheet containing both valid and invalid data and have created a column indentifying the valid data using If statements. I want to make a column containing the average of the previous 720 valid data points. For example, column A is data, column B is the valid flag, and column C will be my average. Let's say cells A1 through A720 are valid, cells A721 through A741 are invalid, and the following data is all valid. Cell C720 should return "average(A1:A720)" and cells C721 through C741 should be blank. For the following cells, cell C742 should return "average(A2:A720,A742)", cell C743 should return "average(A3:A720,A742:A743)". It's difficult to explain, I've attached a sample spreadsheet with an example of the desired results but using an average of 10 valid points so it's easier to work with.

    I'm thinking there may be a way to do this using an if statement, but I have no idea. Any help is appreciated.
    Attached Files Attached Files

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Average of data excluding gaps

    AverageA excludes blanks.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Average of data excluding gaps

    Looking at your example, I would move the "valid" data into another column then use =Averagea at the bottom.

  4. #4
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Average of data excluding gaps

    Actually after looking at the data, I think Average may be the one that excludes blanks and zeros. I tried that one and got 10.6 for the average of your "valid" data.

  5. #5
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Average of data excluding gaps

    here is an your data sheet back with the formulas.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    07-26-2013
    Location
    Massachusetts
    MS-Off Ver
    Excel 2010
    Posts
    47

    Re: Average of data excluding gaps

    Thank you, but perhaps I should have tried to come up with a more descriptive title. I don't want to delete the invalid data, so the cells won't actually be blank. They're just gaps in what data is valid. I need each average to be that of 720 valid data cells, excluding the invalid ones. So, if there's a chunk of invalid data the averages should include all data back to the gap, skip the gap, and make up the difference using data before the gap.

  7. #7
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Average of data excluding gaps

    Ok, see if what I just gave you works, seems to get to what you want. (you were probably typing the reply as I added it.)

  8. #8
    Registered User
    Join Date
    07-26-2013
    Location
    Massachusetts
    MS-Off Ver
    Excel 2010
    Posts
    47

    Re: Average of data excluding gaps

    I see what you mean, I have a similar column which displays blanks for invalid data in my full spreadsheet. However, the average is a 720 hour rolling average for a sheet containing thousands of lines of data. Each average must contain exactly 720 of the previous valid data points.

  9. #9
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Average of data excluding gaps

    Maybe with an pivot table.

    See the attached file.
    Attached Files Attached Files
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  10. #10
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Average of data excluding gaps

    So if I'm understanding this, you want to go to the first 720 "valid" data points and get an average, then to the next 720 "valid" data points and get that average, etc. right? (BTW, I'm not sure I would know how to help on that one but there are people on here that could help.)

  11. #11
    Registered User
    Join Date
    07-26-2013
    Location
    Massachusetts
    MS-Off Ver
    Excel 2010
    Posts
    47

    Re: Average of data excluding gaps

    Yes, sort of. It's a rolling average, so every hour you average the previous n hours of valid data, where n is the averaging time, in this case 720. What you described is a block average, where every 720 valid hours you have one average.

  12. #12
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Average of data excluding gaps

    Please, show the desired result in your file.

  13. #13
    Registered User
    Join Date
    07-26-2013
    Location
    Massachusetts
    MS-Off Ver
    Excel 2010
    Posts
    47

    Re: Average of data excluding gaps

    The desired results are the "Average" column in my original sheet, sorry I should have clarified that. The pivot table may works in theory, but it isn't practical for what I need to do with the data.

  14. #14
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Average of data excluding gaps

    Maybe like this

    See the attached file.
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    07-26-2013
    Location
    Massachusetts
    MS-Off Ver
    Excel 2010
    Posts
    47

    Re: Average of data excluding gaps

    Oh that's getting close to what I need! Thank you, I didn't know about averageif. Now I need it to find exactly ten cells (or 720 for my full sheet) to average. I may be able to work with this and use more indicator/flag columns

  16. #16
    Registered User
    Join Date
    07-26-2013
    Location
    Massachusetts
    MS-Off Ver
    Excel 2010
    Posts
    47

    Re: Average of data excluding gaps

    I'm beginning to think the only way to do exactly what I want is to use a macro, but I was hoping to avoid that haha

  17. #17
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Average of data excluding gaps

    Maybe like this

    See the attached file.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Calculate 'average' between data range of days but excluding weekends(?)
    By iliasark in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-08-2013, 04:39 AM
  2. The rank of average ranks excluding empty cells but including their average.
    By Terminal45 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-21-2012, 03:44 AM
  3. Average excluding DIV/0
    By olga6542 in forum Excel General
    Replies: 1
    Last Post: 06-14-2010, 03:24 PM
  4. Excluding Non Mature Data and Weighted Average
    By helpwithexcel1 in forum Excel General
    Replies: 2
    Last Post: 03-15-2010, 05:14 PM
  5. Replies: 3
    Last Post: 10-27-2009, 01:10 PM

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.6.0 RC 1