+ Reply to Thread
Results 1 to 16 of 16

Can't figure out averaging to ignore blank cells

Hybrid View

  1. #1
    Registered User
    Join Date
    05-25-2012
    Location
    Charlie Burnett Rae
    MS-Off Ver
    Excel for Mac 2011
    Posts
    8

    Can't figure out averaging to ignore blank cells

    Hey people,

    I am massively confused. I have been searching this forum and others for answers, and this has left me even more confused. I need the warm reassurance that only a personalised reply can provide! Excel is pretty much a complete mystery to me and the spreadsheet I have put together has been made entirely from following guidance on the net.

    I am putting together a grade book. What I need is for the average marks of say two tests to be calculated into a percentage - using the marks achieved by the students divided by the maximum marks available. If the cell is blank (i.e. the student was absent for the assessment) I want that to be ignored in the calculation. Getting 15 out of 20 in one test and being absent for the other would therefore produce an average of 75%, for example.

    The formula I have tried using is: =SUM(O3:P3) / (SUM(O$1:P$1) - COUNTIF(O3:P3,"<0")) where O3 and P3 are the marks achieved by the student and O1 and P1 are the maximum marks possible. It isn't working though and is still counting blank cells as zero and skewing the average. What exactly am I doing wrong?

    All help very gratefully received!

    Oh, I will attach the spreadsheet in its current form (I am using Excel for Mac 2011). The formula above relates to column I ("Reading Score), taking marks from columns O and P ("RA1" and "RA2").
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Can't figure out averaging to ignore blank cells

    I think what you're after is:

    =SUM(O3:P3) / SUMIF(O3:P3,">0",O$1:P$1)

  3. #3
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Can't figure out averaging to ignore blank cells

    Hi and welcome to the forum.

    Is this, works for you?

    =SUM(O3:P3) / (SUM(O$1:P$1) - COUNTIF(O3:P3,"<>0")
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

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

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  4. #4
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Can't figure out averaging to ignore blank cells

    In 2007 and above you have AVERAGEIFS(), have you looked at that?
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,677

    Re: Can't figure out averaging to ignore blank cells

    I think it would be difficult to use AVERAGEIFS here because you aren't averaging a single range you are summing one range and then dividing it by the conditional sum of another, which is exactly what Andrew-R's solution does.....although you might want to check for non-blanks rather than >0 if 0 is a valid mark (!)

    =SUM(O3:P3) / SUMIF(O3:P3,"<>",O$1:P$1)
    Audere est facere

  6. #6
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Can't figure out averaging to ignore blank cells

    I don't think AVERAGEIF or AVERAGEIFS can be made to work in this scenario, because the function is determining a percentage, not an average. For the same reason any solution involving COUNTIF is going to return the wrong result.

  7. #7
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Can't figure out averaging to ignore blank cells

    I was playing with
    =IF(OR(O3="",P3=""),2,1)*AVERAGE((O3/$O$1),(P3/$P$1))
    It seems to work and it handles the possibility of zero being a valid score.

    That's why I thought of AVERAGEIFS(), but I don't have access to 2007 at the moment.

  8. #8
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,677

    Re: Can't figure out averaging to ignore blank cells

    Quote Originally Posted by Marcol View Post
    I was playing with
    =IF(OR(O3="",P3=""),2,1)*AVERAGE((O3/$O$1),(P3/$P$1))
    It seems to work and it handles the possibility of zero being a valid score.

    That's why I thought of AVERAGEIFS(), but I don't have access to 2007 at the moment.
    Hello Marcol,

    Yes, AVERAGE can work, e.g. this "array formula" for a range

    =AVERAGE(IF(O3:P3<>"",O3:P3/O$1:P$1))

    confirmed with CTRL+SHIFT+ENTER

    ....but because the range you're averaging is O3:P3/O$1:P$1 rather than a single range on the spreadsheet you can't use that in AVERAGEIF(S)

  9. #9
    Registered User
    Join Date
    05-25-2012
    Location
    Charlie Burnett Rae
    MS-Off Ver
    Excel for Mac 2011
    Posts
    8

    Re: Can't figure out averaging to ignore blank cells

    Thank you for the speedy replies everyone - greatly appreciated. I was going to go for Andrew's suggestion (which worked
    perfectly) but on balance perhaps daddylonglegs' is more appropriate. I don't anticipate anyone scoring a zero but it seems
    sensible to cover my bases!

    One other question, now that I have you - I have two tables in the spreadsheet: the one on top is for inputing and displays marks, percentages and grade; the one below is a grade summary designed to be more readable and for filling out certificates.

    I can sort the values in the top table fine, but it doesn't seem to work on the bottom table - I am using the =""& function to mirror the values from the top table, and thought perhaps that might be the problem. Any thoughts?

    PS. I realise I can just sort the top table is I want, but would like the convenience of sorting directly in the bottom table if possible.

    I have attached the updates spreadsheet. proving ground gradebook prev. vers..xls

  10. #10
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Can't figure out averaging to ignore blank cells

    If I may provide my two cents, why not add a quick macro to hide/unhide columns D, E, G, I and so on, then you do not have to keep the extra table with links because when you toggle the hide/unhide it will look jus like the table below.
    HTH
    Regards, Jeff

  11. #11
    Registered User
    Join Date
    05-25-2012
    Location
    Charlie Burnett Rae
    MS-Off Ver
    Excel for Mac 2011
    Posts
    8

    Re: Can't figure out averaging to ignore blank cells

    OK great - would you mind walking me through it?

    Also, any advice on my most recent post would be appreciated. Thanks.

  12. #12
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Can't figure out averaging to ignore blank cells

    Again, just a suggestion, but it does avoid having to create links.

    Enable macros when opening workbook.

    In column Y, two shapes, Hide and Unhide which are both assigned to macros which you can view by selecting Alt + F11.

    Alt + Q will close the VBE and get you back to Excel.

    Adjust the Sub HideColumns() to you desires.

    As far as the formula, I am going to defer to the formula experts
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    05-25-2012
    Location
    Charlie Burnett Rae
    MS-Off Ver
    Excel for Mac 2011
    Posts
    8

    Re: Can't figure out averaging to ignore blank cells

    Apologies - any chance of being a bit more detailed in the instructions? I'm really pretty lost when in comes to excel. Also, I'm using a macbook, so some of the shortcuts won't work for me.

  14. #14
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Can't figure out averaging to ignore blank cells

    Well I'm in the same boat as you as far as knowing what a macbook has to offer.

    I can write all sorts of detailed instructions, but it's easier to go off of what you are having trouble with.

  15. #15
    Registered User
    Join Date
    05-25-2012
    Location
    Charlie Burnett Rae
    MS-Off Ver
    Excel for Mac 2011
    Posts
    8

    Re: Can't figure out averaging to ignore blank cells

    Thanks for the ongoing help guys - my gradebook is back with a vengeance and (courtesy of a template I used) a lot prettier - see what you think.

    My clumsy formulas aren't completely cutting the mustard though. You'll notice that if you sort by Course Grade (column E)the Total % column (column F) doesn't sort correspondingly.

    Similarly, sorting by Performance doesn't sort it accurately in columns E and F. What is strange is that you can see the incell graphs in Performance ascend or descend in order - but that doesn't match the figures in the Total % column. Meaning that the incell graphs are showing more of these [|] for some of the lower percentages. Just can't figure out what's happening in those columns!hopefully compatablie.xls

    I have been throwing this back and forth between Excel 2011 for Mac at home, and Windows Excel 2003 at work - the source of the problem?

  16. #16
    Registered User
    Join Date
    05-25-2012
    Location
    Charlie Burnett Rae
    MS-Off Ver
    Excel for Mac 2011
    Posts
    8

    Re: Can't figure out averaging to ignore blank cells

    Anyone available to help? It's quite a handsome spreadsheet I think, but I do need help behind the scenes!

+ 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