+ Reply to Thread
Results 1 to 9 of 9

Calculate average excluding zeros in a non continguous range

  1. #1
    Registered User
    Join Date
    12-18-2018
    Location
    Utrecht
    MS-Off Ver
    2016
    Posts
    14

    Calculate average excluding zeros in a non continguous range

    Hi guys,

    I have a question about a data set of a hotel. We are calculating the average ADR per year per segment. Normally I would use the function Average and select from every year the first number. Divide it by 7 and there is my answer. Double click on the number and I have all the averages for that segment.

    However the problem now is; some rows have an ADR of 0 in it. This will effect the total average. I know that the formula AverageIF can be used. But I do not know how to fill in the range, criteria and (average range) so it does not include the zero's.
    The difficulty here is that I am working with a Non-Continguous range.

    Can you help me?
    Attached Files Attached Files

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: Calculate average excluding zeros in a non continguous range

    So what exactly are you trying to average? What is a segment?
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    12-18-2018
    Location
    Utrecht
    MS-Off Ver
    2016
    Posts
    14

    Re: Calculate average excluding zeros in a non continguous range

    The average of the ADR for every day. Attached you can find an example of 1 segment: corporate individual.

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Calculate average excluding zeros in a non continguous range

    =sum($e$5:$e$200)/(rows($e$5:$e$200)-countif($e$5:$e$200,0)+countif($e$5:$e$200,""))
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  5. #5
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Calculate average excluding zeros in a non continguous range

    Is this right?

    G5
    =SUMPRODUCT((MOD(ROW(),17)=MOD(ROW($C$4:$C$999),17))*$E$4:$E$999)/SUMPRODUCT(--((MOD(ROW(),17)=MOD(ROW($C$4:$C$999),17))*$E$4:$E$999>0))
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    12-18-2018
    Location
    Utrecht
    MS-Off Ver
    2016
    Posts
    14

    Re: Calculate average excluding zeros in a non continguous range

    Hi thank you for your reaction! Much appreciated.

    The formula helped but I cannot apply it to other data, because I do not fully understand the formula. So for example, what does the 17 stand for? How can we apply this formula to the other data without getting an error.

    Looking forward to hearing from you

  7. #7
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Calculate average excluding zeros in a non continguous range

    17 is from row(C4) 2012 and row(C21) 2013 21-4 = 17. Your data is repeat every 17 rows.

    Just change this Number accordingly.

  8. #8
    Registered User
    Join Date
    12-18-2018
    Location
    Utrecht
    MS-Off Ver
    2016
    Posts
    14

    Re: Calculate average excluding zeros in a non continguous range

    Thank you so much! It worked out. And could you help us with the MEDIAN formula as well? it is the exact same data but then the Median.

  9. #9
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Calculate average excluding zeros in a non continguous range

    Please try at J5 and Press Ctrl+Shift+Enter

    =MEDIAN(AGGREGATE(14,6,INDEX(E5:E120,N(IF(1,ROW(INDIRECT("1:"&COUNT(C:C)))*17-16))),ROW(INDIRECT("1:"&SUM(COUNTIF(OFFSET(E5,ROW(INDIRECT("1:"&COUNT(C:C)))*17-17,),">0"))))))
    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] Average excluding zeros
    By adelem in forum Excel General
    Replies: 2
    Last Post: 05-03-2016, 05:06 AM
  2. [SOLVED] how to find average of a range excluding the zeros.
    By sumesh56 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-06-2013, 10:28 PM
  3. Average excluding zeros over a variable range of fixed size
    By tface in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 02-09-2013, 08:23 AM
  4. [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
  5. [SOLVED] Average for non-consecutive cells excluding zeros (even when they all contain zeros)
    By pao13 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-05-2012, 04:32 PM
  6. [SOLVED] Average, Excluding Zeros, Non-Consecutive Range
    By Coal Miner in forum Excel General
    Replies: 9
    Last Post: 08-04-2005, 06:05 PM
  7. Average non continguous cells, excluding zero's
    By Keithlearn in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-27-2005, 09:06 AM

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