+ Reply to Thread
Results 1 to 17 of 17

Average excluding zeros over a variable range of fixed size

  1. #1
    Registered User
    Join Date
    07-31-2012
    Location
    Bangalore, India
    MS-Off Ver
    Office 2010
    Posts
    6

    Average excluding zeros over a variable range of fixed size

    Hi,

    I know how to calculate the average excluding zeros. But what I want is something more akin to 'keep going until you find 7 non-zero values, and average that". So if I had a range of 30 items, and was at the 9th cell, I would start averaging from where I was, and go backwards. If I found 7 non-zero values, I would average that, otherwise I would go forwards. If neither worked, I would pick the one that had the highest number of non-zero values to average with.

    This sounds great in my head but I have no idea how to implement it x_x. Help would be appreciated.

  2. #2
    Forum Contributor
    Join Date
    12-14-2012
    Location
    Doha, State of Qatar
    MS-Off Ver
    excel 2003, 2007, 2010, 2016
    Posts
    124

    Re: Average excluding zeros over a variable range of fixed size

    post an example if you can in an excel sheet

  3. #3
    Registered User
    Join Date
    07-31-2012
    Location
    Bangalore, India
    MS-Off Ver
    Office 2010
    Posts
    6

    Re: Average excluding zeros over a variable range of fixed size

    Not sure how to attach a file... I'll just give an example with a list of numbers.

    3
    5
    0
    7
    8
    2
    10
    9
    4
    0
    0
    0
    0
    2
    8
    12

    So, 10th cell from the top here is a 0. Say I was there, and wanted an average of 7 non-zeros that preceded it, it would be (4 + 9 + 10 + 2 + 8 + 7 + 5)/7, skipping over cell 3, which is zero. If I went forwards in the same manner, I would only find 3 non-zeros. If I only had 6 non-zeros before cell 10 and wanted 7, I would compare going forwards with going backwards and take going backwards, which has more non-zero values.
    Last edited by tface; 01-29-2013 at 06:19 AM.

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Average excluding zeros over a variable range of fixed size

    Use Averageif Function like the below

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Adjust the range reference A1:A16 to your desired range.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  5. #5
    Registered User
    Join Date
    07-31-2012
    Location
    Bangalore, India
    MS-Off Ver
    Office 2010
    Posts
    6

    Re: Average excluding zeros over a variable range of fixed size

    The problem is that I need to apply this to multiple datasets, each of which has a different range that corresponds to my desired number of non-zero values. If I use the whole range, I get more non-zero values than I wanted. If I used a fixed size, say 10, and move along the sheet, it may have more non-zero values, it may have less, it may have none.

    i.e. the amount of manual effort required to set the range for each data set is too large. I need excel to be smart about recognizing the range, or work over the whole range and stop when it hits the required number of non-zero values.

  6. #6
    Forum Contributor
    Join Date
    12-14-2012
    Location
    Doha, State of Qatar
    MS-Off Ver
    excel 2003, 2007, 2010, 2016
    Posts
    124

    Re: Average excluding zeros over a variable range of fixed size

    click Go Advanced while you are writing a post, then either use the paperclip icon or click on Manage Attachments and follow the steps....to attach a file

    reagrds,
    abdul

  7. #7
    Registered User
    Join Date
    07-31-2012
    Location
    Bangalore, India
    MS-Off Ver
    Office 2010
    Posts
    6

    Re: Average excluding zeros over a variable range of fixed size

    Here's an example data set with example desired values, setting desired number of non-zero values at 7.
    Attached Files Attached Files

  8. #8
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Average excluding zeros over a variable range of fixed size

    You should give some brief about how to set the range or method to arrive the averageif, because without knowing the method we can't suggest something on assumption.........

  9. #9
    Forum Contributor
    Join Date
    12-14-2012
    Location
    Doha, State of Qatar
    MS-Off Ver
    excel 2003, 2007, 2010, 2016
    Posts
    124

    Re: Average excluding zeros over a variable range of fixed size

    yup sixth sense i am with you how to calculate the same on assumption

  10. #10
    Registered User
    Join Date
    07-31-2012
    Location
    Bangalore, India
    MS-Off Ver
    Office 2010
    Posts
    6

    Re: Average excluding zeros over a variable range of fixed size

    I'm honestly not sure what more to say about the problem

    If you're saying that based on the excel file I attached, well, yes, it makes no sense without my other posts in this thread, because I don't know how to implement exactly what I want without manually setting different ranges every time in each cell.

  11. #11
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Average excluding zeros over a variable range of fixed size

    Quote Originally Posted by abubaniyan View Post
    yup sixth sense i am with you how to calculate the same on assumption
    I am aware and thanks for confirming it That's why i mentioned

    we can't suggest something on assumption.........

  12. #12
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Average excluding zeros over a variable range of fixed size

    Quote Originally Posted by tface View Post
    I'm honestly not sure what more to say about the problem
    No worries You just explain us how you are setting the range for each cells? how you are differentiating each ranges for each cells? Just explain the method you are using to calculate the average for each cells, we will take care of building it in formula

  13. #13
    Forum Contributor
    Join Date
    12-14-2012
    Location
    Doha, State of Qatar
    MS-Off Ver
    excel 2003, 2007, 2010, 2016
    Posts
    124

    Re: Average excluding zeros over a variable range of fixed size

    my pleasure dude....

  14. #14
    Registered User
    Join Date
    07-31-2012
    Location
    Bangalore, India
    MS-Off Ver
    Office 2010
    Posts
    6

    Re: Average excluding zeros over a variable range of fixed size

    Quote Originally Posted by :) Sixthsense :) View Post
    No worries You just explain us how you are setting the range for each cells? how you are differentiating each ranges for each cells? Just explain the method you are using to calculate the average for each cells, we will take care of building it in formula
    Okay, considering 30 cells, say I am at the 15th cell. I want to know the average of 7 non-zero values in the same data set, that lie before the 15th cell.

  15. #15
    Registered User
    Join Date
    07-31-2012
    Location
    Bangalore, India
    MS-Off Ver
    Office 2010
    Posts
    6

    Re: Average excluding zeros over a variable range of fixed size

    Double post
    Last edited by tface; 01-29-2013 at 08:26 AM. Reason: Double posted

  16. #16
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Average excluding zeros over a variable range of fixed size

    Not sure why your some of the average ranges are going UPWARD and some of them are going DOWNWARD, can you please explain the logic?

    Refer the attached file to see what I did so far......
    Attached Files Attached Files

  17. #17
    Registered User
    Join Date
    07-31-2012
    Location
    Bangalore, India
    MS-Off Ver
    Office 2010
    Posts
    6

    Re: Average excluding zeros over a variable range of fixed size

    I can't see the last post here for some reason.... keep clicking pg 2/last and it keeps returning me to page 1

  18. #18
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,724

    Re: Average excluding zeros over a variable range of fixed size

    In your User Profile you can adjust the number of posts that you can display for each thread - click on General Settings, then scroll down to Thread Display Options - I have mine set to 40 posts, so there is no problem viewing all the posts in this thread.

    Hope this helps.

    Pete

  19. #19
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Average excluding zeros over a variable range of fixed size

    @Peter,

    Now myself and OP are able to view the second page, but before that we cant able to view it. I belive the tech persons resolved the problem now.

    At the same time thanks for the info about changing the number of counts per page. But if i turn on the setting to show more posts then whenever I login in my mobile and see any of the latest replies then It will load all the posts and consume more data usage and my service provider will charge more and thats why like to have it in lesser count.

+ 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