Geeks on Campus

Another amazing bgsu blog

Happy New Year and COUNTIF

Posted by jeggent on December 29, 2011

Happy New Year to you all!

I hope 2011 treated you well.

Well it’s over.  I’ve graduated.  Hopefully I will be able to stick with my plan of blogging more now that I am not taking classes anymore.  I’m not going to make any grand promises though.  I have a pretty bad track record at staying with blogs.

To kick things back off with this blog I going to talk about the COUNTIF() function in Excel.  This is a very useful function with which you can count of the number of occurrences of something in a range. For example the formula =COUNTIF(A1:A20,B2) will tell you how many of cells in the range of A1 to A20 are equal to the cell B2.  The problem for me has been the way the function is presented by the function wizard (or whatever it’s called) in Excel.  The wizard makes it easy to select the range to check and specify a criteria cell, however it doesn’t give you the syntax to use inequalities (i.e. > or <).

Recently I was working with a list which included students’ enrollment in the upcoming Spring term and wanted a count of how many were enrolled.  In other words, how many had enrollment greater than zero.  The formula for this value is =COUNTIF(A1:A20,”>0″). The secret here is the quote marks around the inequality.  This formula shows how many cells in the range A1 to A20 have values greater than zero.

I hope this helps.