How To Get an Item Count in Google Sheets

Here's a quick and dirty formula you can use in Google Sheets to get a running count of cells that contain any value (numbers, dates, text, links, etc.).

As an example, we'll create a little ersatz gradebook that will track the number of assignments that have been completed by a given student, then use that information to calculate a running average score (in other words, an average for only the assignments that have been completed).

This gradebook is, of course, for illustrative purposes only. This formula can be used to count anything in a spreadsheet over any range. It's also applicable across platforms and could easily be used in desktop tools like LibreOffice or Microsoft Excel.

 item count example in google sheets

The figure above shows our sample spreadsheet. In Column F, as you can see, we're counting the number of assignments completed using this formula:

=countif(B2:E2, "<>")

That simply creates a count of non-empty cells within a given range — in this case B2 to E2, in the next row down B3 to E3, in the one after that B4 to E4, etc. Those totals will automatically update any time a new score is added, as seen in the image below.

 sum example in google sheets

 

Time-saving tip: Once you insert the formula, you can select the cell, copy it, and paste to to a new row, an the cell range will automatically shift to the correct row. If instead you want to keep the original range, then double-click the cell and copy the text out of it, then paste it into a new cell.

The rest of it is very straightforward, but I'll explain it for those who might not be familiar with equations in spreadsheets.

In column G, "Total Points," we're simply using the SUM function and specifying the range of cells whose values we want to add together. That is illustrated in the figure below.

 divide example in google sheets

And then, finally, we're dividing the accumulated points (column G) by the total number of completed assignments (column F) in order to calculate a running average. This is done using the DIVIDE function, pictured below.

 item count example in google sheets

That's it! If you run into any trouble, ask me a question in the comments section below.

 

About the Author

David Nagel is the former editorial director of 1105 Media's Education Group and editor-in-chief of THE Journal, STEAM Universe, and Spaces4Learning. A 30-year publishing veteran, Nagel has led or contributed to dozens of technology, art, marketing, media, and business publications.

He can be reached at [email protected]. You can also connect with him on LinkedIn at https://www.linkedin.com/in/davidrnagel/ .


Featured

  • Abstract geometric pattern with interconnected nodes and lines

    Microsoft 365 Copilot Updates Offer Expanded AI Capabilities, Collaboration Tools

    Microsoft has announced updates to its Microsoft 365 Copilot AI assistant, including expanded AI capabilities in individual apps, the ability to create autonomous agents, and a new AI-powered collaboration workspace.

  • An open book with text transforming into smooth lines represents reading ease

    Fluency Innovator Grants to Award Free Subscriptions to WordFlight Literacy Intervention Solution

    The call for applications is now open for Foundations in Learning's Fall 2024 Fluency Innovator Grants program. Teachers and administrators from schools and districts serving grades 3-8 may apply to receive a free subscription to WordFlight, a literacy assessment and intervention solution for students with deficits in reading fluency and comprehension, for the Fall 2024 semester.

  • AI-themed background with sparse circuit lines and minimal geometric shapes

    Microsoft to Introduce AI Agent Building Tools in Copilot Studio

    In November, Microsoft plans to roll out a public preview of a new feature within Copilot Studio, allowing users to create autonomous AI "agents" designed to handle routine tasks.

  • landscape photo with an AI rubber stamp on top

    California AI Watermarking Bill Supported by OpenAI

    OpenAI, creator of ChatGPT, is backing a California bill that would require tech companies to label AI-generated content in the form of a digital "watermark." The proposed legislation, known as the "California Digital Content Provenance Standards" (AB 3211), aims to ensure transparency in digital media by identifying content created through artificial intelligence. This requirement would apply to a broad range of AI-generated material, from harmless memes to deepfakes that could be used to spread misinformation about political candidates.