+ Reply to Thread
Results 1 to 12 of 12

calculate average of non contiguous row

Hybrid View

  1. #1
    Registered User
    Join Date
    07-28-2013
    Location
    southampton, england
    MS-Off Ver
    Excel 2010
    Posts
    39

    calculate average of non contiguous row

    Hi

    I thought this would be simple but its taking me forever! I have three values that I want to calculate the average for. However they are in a row that has other data in it and some have zero value. So in the example (attached) could someone tell me how to calculate the average which should be '2' but is coming out as 1.33333 etc?

    Many thanks
    Attached Files Attached Files

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

    Re: calculate average of non contiguous row

    Try this formula

    =SUM(B2,D2,F2)/MAX(1,(B2>0)+(D2>0)+(F2>0))
    Audere est facere

  3. #3
    Registered User
    Join Date
    07-28-2013
    Location
    southampton, england
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: calculate average of non contiguous row

    Hi
    Many thanks - i can see it works in the example I gave but I transfered it to the workbook and it has returned the value of two again. The only difference between my workbook and the example I gave is that there is a linked blank cell in B2.......I therefore deleted the value in the example of B2 thinking it would return a value of 2 but it still seemed to work correctly - any ideas and why isnt anything simple!
    regards

  4. #4
    Registered User
    Join Date
    07-28-2013
    Location
    southampton, england
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: calculate average of non contiguous row

    Hi
    Many thanks - i can see it works in the example I gave but I transfered it to the workbook and it has returned the value of two again. The only difference between my workbook and the example I gave is that there is a linked blank cell in B2.......I therefore deleted the value in the example of B2 thinking it would return a value of 2 but it still seemed to work correctly - any ideas and why isnt anything simple!
    regards

  5. #5
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: calculate average of non contiguous row

    Maybe if you could provide a spreadsheet with a more accurate characteristics of your problem, we should be able to find a suitable solution for it.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  6. #6
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: calculate average of non contiguous row

    Try this and see if it works for you

    =SUM(B2,D2,F2)/SUMPRODUCT(($A$1:$F$1="Average grade")*(--(A2:F2>0)))

  7. #7
    Registered User
    Join Date
    07-28-2013
    Location
    southampton, england
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: calculate average of non contiguous row

    Hi
    Thanks for the reply - in the attached I have put the given formula in column P and the formula I was using in column 'O'. If you look at row 2 you can see my formula working correctly but the given formula not. If I enter a 0 value in F2 the given formula works and my one doesn't! There are similar scenarios for row 4 and row 9. I need the formula to work whether or not there is a blank or a zero value in the relevant cell. Hope you get what I mean and you can solve for me!
    best regards
    Attached Files Attached Files

  8. #8
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: calculate average of non contiguous row

    Unless the grades being averaged have equal base values from which the averages are obtained, the average of averages is not worth calculating. There appears to be a too much missing from the problem in order to solve it as it stands.

    A posting of what you are actually working with would be of value.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  9. #9
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: calculate average of non contiguous row

    The formula in post #6 works just fine. For the new layout I just adjusted range. See formula below:

    Corrected formula: For your settings, because values populated from connected workbook the last argument should be not >0 but <>""

    =IFERROR(SUM(F2,I2,L2)/SUMPRODUCT(($F$1:$L$1="Average Grade")*(--(F2:L2<>""))),0)
    Last edited by AlKey; 01-05-2014 at 11:49 AM.

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

    Re: calculate average of non contiguous row

    To ignore blanks and zeroes but avoid errors you can use this formula

    =SUM(F2,I2,L2)/MAX(1,INDEX(FREQUENCY((F2,I2,L2),0),2))

    ...or perhaps simpler with AVERAGEIFS

    =IFERROR(AVERAGEIFS(F2:L2,F$1:L$1,"Average Grade",F2:L2,">0"),0)
    Last edited by daddylonglegs; 01-05-2014 at 11:58 AM.

  11. #11
    Registered User
    Join Date
    07-28-2013
    Location
    southampton, england
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: calculate average of non contiguous row

    resolved - post closed thanks

  12. #12
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: calculate average of non contiguous row

    You're welcome. Don't forget to thank those who helped by clicking on Add Reputation * and please mark thread as "Solved" if your issue has been resolved. (Selecting Thread Tools-> Mark thread as Solved).

+ 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. average formula for non contiguous range and eliminate blank cells
    By kkotter in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-28-2013, 10:13 AM
  2. [SOLVED] How to delete multiple contiguous (and/or) non-contiguous rows, in an excel table
    By jimmalk in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-03-2012, 05:48 AM
  3. Average of non-contiguous column
    By MCII in forum Excel General
    Replies: 5
    Last Post: 12-24-2008, 02:30 PM
  4. Running Average with non-contiguous data
    By deedot in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-10-2008, 01:09 PM
  5. Average Non-Contiguous numbers
    By Teri in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-20-2005, 05:06 PM

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