+ Reply to Thread
Results 1 to 16 of 16

Excel 2010 Average Ignoring Zero Values - Non-consecutive cells

  1. #1
    Registered User
    Join Date
    06-26-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    33

    Excel 2010 Average Ignoring Zero Values - Non-consecutive cells

    Hi,

    I have cells that I need to work out averages for but I need the average to exclude any 0 values.
    The cells are non-consecutive so I haven't been able to use averageif successfully.

    As an example, I need to average f3,i3,l3,o3. Some of these are 0 and I want the average to exclude them.
    I have about 900 rows of data and will be copying the formula down as the columns I need are all the same.

    I would prefer a solution without an array formula if possible as other people are going to be populating this spreadsheet and they have minimal excel knowledge.

    Thank you.

    L
    Last edited by lanos; 10-23-2013 at 07:17 AM. Reason: Solved

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Excel 2010 Average Ignoring Zero Values - Non-consecutive cells

    Hi,

    Can I ask what's in e.g. cells G3, H3, J3, K3, etc. which is preventing you from averaging across a contiguous range? I presume they are numerical, since, if not, =AVERAGEIF(F3:O3,"<>0") would happily exclude them from its calculation.

    I also notice that there is a pattern to the values which you wish to be averaged (every third cell) - is this always the case? Could you give a more definitive list of those cells which you wish to average (assuming it's more than just F3, I3, L3 and O3)?

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Excel 2010 Average Ignoring Zero Values - Non-consecutive cells

    Try this...

    =AVERAGE(IF(F3<>0,F3,{""}),IF(I3<>0,I3,{""}),IF(L3<>0,L3,{""}),IF(O3<>0,O3,{""}))
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Excel 2010 Average Ignoring Zero Values - Non-consecutive cells

    Or...

    =SUMPRODUCT(INDEX((MOD(COLUMN(F3:O3),3)=0)*F3:O3,,)/SUMPRODUCT((MOD(COLUMN(F3:O3),3)=0)*(F3:O3<>0)))

    Regards

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Excel 2010 Average Ignoring Zero Values - Non-consecutive cells

    I was going in this direction:

    Array entered**:

    =AVERAGE(IF(MOD(COLUMN(F3:O3),3)=0,IF(F3:O3<>0,F3:O3)))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

    But figured that's kind of "overkill" to calculate just 4 cells.

  6. #6
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Excel 2010 Average Ignoring Zero Values - Non-consecutive cells

    "I was going in this direction:"

    I was trying to avoid an array formula!

    Edit: in any case, it'd be a shame to take the emphasis away from that {""}-syntax solution.

    Regards

  7. #7
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Excel 2010 Average Ignoring Zero Values - Non-consecutive cells

    Here's another way.....

    =SUM(F3,I3,L3,O3)/INDEX(FREQUENCY((F3,I3,L3,O3),0),2)
    Audere est facere

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Excel 2010 Average Ignoring Zero Values - Non-consecutive cells

    We don't know if there might be negative numbers. That's why I used <>0 instead of >0.

    Good option, though.

  9. #9
    Registered User
    Join Date
    06-26-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Excel 2010 Average Ignoring Zero Values - Non-consecutive cells

    Thank you for all the replies and help!

    To answer the questions:
    - there are no negative values in the cells that are in between.
    Currently, it's every 3rd cell but this may change going forward. At the moment I need to work out the averages for f3,i3,l3,o3, then copy down for f4,i4,l4,04, and row 5 etc.
    The values in between are numbers but they're not to be used for this average, which is why I can't use averageifs.

    I'm going to try the solutions given later today and will feed back.

    Thank you again!

    L

  10. #10
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Excel 2010 Average Ignoring Zero Values - Non-consecutive cells

    Do you have any headers or similar in row 1 or 2 which would indicate which columns should be included? If so then you can use AVERAGEIFS and include the header criteria, e.g. if F1, I1, L1 and O1 all contain the text value "Total" you can use this formula

    =AVERAGEIFS(F3:O3,F3:O3,"<>0",F$1:O$1,"Total")

  11. #11
    Registered User
    Join Date
    06-26-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Excel 2010 Average Ignoring Zero Values - Non-consecutive cells

    I just tried this one:
    =SUMPRODUCT(INDEX((MOD(COLUMN(F3:O3),3)=0)*F3:O3,,)/SUMPRODUCT((MOD(COLUMN(F3:O3),3)=0)*(F3:O3<>0)))

    But unfortauntely it did't work as it wasn't ignoring the 0 values when working out the average.
    Eg, f3 = 0.44 but all the other columns I'm lokoing at are 0 (i3,l3,o3) so it should give me 0.44 as the answer but it gave 0.11 as the result.

    Thanks anyway!

  12. #12
    Registered User
    Join Date
    06-26-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Excel 2010 Average Ignoring Zero Values - Non-consecutive cells

    Quote Originally Posted by Tony Valko View Post
    Try this...

    =AVERAGE(IF(F3<>0,F3,{""}),IF(I3<>0,I3,{""}),IF(L3<>0,L3,{""}),IF(O3<>0,O3,{""}))
    This works perfectly - thank you!

  13. #13
    Registered User
    Join Date
    06-26-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Excel 2010 Average Ignoring Zero Values - Non-consecutive cells

    Quote Originally Posted by daddylonglegs View Post
    Here's another way.....

    =SUM(F3,I3,L3,O3)/INDEX(FREQUENCY((F3,I3,L3,O3),0),2)
    Thanks works too - thank you!

  14. #14
    Registered User
    Join Date
    06-26-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Excel 2010 Average Ignoring Zero Values - Non-consecutive cells

    Quote Originally Posted by daddylonglegs View Post
    Do you have any headers or similar in row 1 or 2 which would indicate which columns should be included? If so then you can use AVERAGEIFS and include the header criteria, e.g. if F1, I1, L1 and O1 all contain the text value "Total" you can use this formula

    =AVERAGEIFS(F3:O3,F3:O3,"<>0",F$1:O$1,"Total")
    This works perfectly and I like that it's a "simple" formula - I have header criteria that I was able to use for this and I think this will work for future entries, when the spreadsheet is expanded to more than 4 columns I need to look at!
    Thank you very much.

  15. #15
    Registered User
    Join Date
    06-26-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: Excel 2010 Average Ignoring Zero Values - Non-consecutive cells

    Solved thread - thank you to everyone for your contributions.

    L

  16. #16
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Excel 2010 Average Ignoring Zero Values - Non-consecutive cells

    You're welcome. We appreciate the feedback!

+ 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. Getting average but ignoring cells with blank (#value!)
    By Elainefish in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-23-2013, 08:30 AM
  2. [SOLVED] Average for non-consecutive cells, excluding zero values.
    By musik7 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-29-2013, 06:11 PM
  3. Conditional weighted average ignoring #N/A values
    By syoung27 in forum Excel General
    Replies: 4
    Last Post: 02-22-2012, 10:48 AM
  4. Average ignoring Blanks cells
    By Justinmih in forum Excel General
    Replies: 10
    Last Post: 09-30-2011, 06:21 PM
  5. Replies: 3
    Last Post: 06-17-2010, 03:04 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