Google Sheets – Get the Top 2 Grades for Each Group in a Spreadsheet using RANK and FILTER

This week I was asked to provide a list of the top two student grades in each of the 100 classes in our university program. 

Normally, this would be a pretty easy task if there were only a half dozen or so classes. Simply sort by group (class) and then Grade. Finally copy and paste the top 2 ranked students of each group in a new sheet – print and hand to the boss. 

However, with 100 classes this was going to turn into a time consuming chore and one that could be prone to errors. 

To solve this problem, I took advantage of Google Sheets RANK.EQ and FILTER formulas. Let’s take a peek at the formula now and go through the steps in detail later.

Let’s move on to an example.

Continue reading “Google Sheets – Get the Top 2 Grades for Each Group in a Spreadsheet using RANK and FILTER”

Google Apps Script – How to make a Custom Function to Use in Google Sheets

Google Apps Script

Google Sheets has a vast library of functions (or formulas) you can use to get your Spreadsheet tasks done. However, there are some instances when you want a specific function that is not available in Google Sheets or want to make a simplified version of some combined function to make life easier for your users. Fortunately, Google has your back with Google Apps Script.

Before we start, Google does a pretty great job explaining the basics of creating a custom function. However, when it comes to explaining how to add all that information that goes into a function when you type it into Sheets it is a bit vague.

Custom Function Decorators Google Apps Script

Let’s look at the creation process through a recent example I created:

Continue reading “Google Apps Script – How to make a Custom Function to Use in Google Sheets”

Google Sheets – Random Alphabetic, Random Alphanumeric and Random Alphanumeric + Character Custom Functions

Google Sheets, Google Apps Script

I was working on a Spreadsheet in Google Sheets a few days ago and needed to generate some random codes for my users. To do this, I just used the RANDBETWEEN(start val, end val) function built into Google Sheets.

It goes a little like this. If I want to build a 5 digit random number I would:

RANDBETWEEN Google Sheets

But this got me wondering. Is there a function for random Alphabetic strings or Alphanumeric strings or Alphanumeric with Character strings. The answer?

via GIPHY

 

No…

So instead I decided to make a custom function with Google Apps Script to do this job for me…

Continue reading “Google Sheets – Random Alphabetic, Random Alphanumeric and Random Alphanumeric + Character Custom Functions”

Google Apps Script – How to Automatically Generate a Time From a Four Digit 24 hour Time in Google Sheets.

Google Apps Script, Google Sheets

On a recent board post a Google Sheets user wanted to change a four digit number (for example, 1230) to a time, like 12:30, in the same cell that the item was entered.

Unfortunately the user was not in a position to change the starting values, so they were left with the 4 digits.

There are two ways of doing this with varying levels of complexity:

 

  1. The Google Sheets Formula Approach
  2. The Google Apps Script onEdit Approach

Continue reading “Google Apps Script – How to Automatically Generate a Time From a Four Digit 24 hour Time in Google Sheets.”

How to Hide a Row based on a Cell Value in Google Sheets with Filter or Google Apps Script.

Google Sheets, Google Apps Script

Sometimes, when you are working on a shared Google Sheet you might want to hide a row based on a cell value.

For example, perhaps we don’t want to see row information of orders that have been paid for. Take a look at my D&D miniatures wholesale orders sheet (image below). I know I don’t need to follow up the orders that have been paid, marked with a ‘Yes’ in column F, so I don’t want to see them on my sheet.

We want to hide the "Yes" - Google Sheets

We can hide these two ways:

  1. Create a filter.
  2. Google Apps Script onEdit() trigger.

Continue reading “How to Hide a Row based on a Cell Value in Google Sheets with Filter or Google Apps Script.”

Sections to Sheets – Free Google Add-on That Separates Column Sections Into Individual Sheets for Page-by-Page Export or Printing

What is Sections to Sheets?

Sections to Sheets is a free Google Sheets Add-on that separates rows by column sections and puts them in individual pages or sheets in a spreadsheet in preparation export and printing.

You can find Sections to Sheets at the Google Chrome Webstore.

Chrome Web Store Badge

Example 1

Let’s say you want to print out a list of expenditures by department and you want each department to start on a new page. You’ll also want to keep the same header for each page.

Example 2

You might want to export a list of grades by class number. You sort the grades by class and then export the list with each class starting on a new page with a header and footer.

Sections to Sheets can help you achieve this quickly by creating a new Google Spreadsheet and separating each selection and putting it into a new Sheet(tab) with or without headers and footer. This will enable you to quickly export or print your sheets.

Continue reading “Sections to Sheets – Free Google Add-on That Separates Column Sections Into Individual Sheets for Page-by-Page Export or Printing”

How do I reverse the Rows in A Column in Google Sheets?

Reverse Rows in Column in Google Sheets
My favourite Killjoy members. Column A – From most favourite. Column B Saving the best for last.

Sometimes you have a need to reverse a list quickly in Google Sheets.

That’s pretty easy to do if the list is sorted alphabetically. Just go on into the <Data> menu and choose from one of the sort functions. But what if the data you want to flip is not in alphabetical or numeric order?

Below are 3 ways to reverse your data:

For the examples below, I’ll be using a list of my favourite Killjoys characters. Yeah, I’m a sci-fi geek.

Continue reading “How do I reverse the Rows in A Column in Google Sheets?”

Add the Current Date to a Sheet When Data Is Added So That The Date Does Not Change(Static) – Google Sheets

You’ve probably come across the problem where you need to know when a piece of data has been added to your spreadsheet. You probably have been equally frustrated that there is no out-of-the-box function that will do just this.

You’ve tried TODAY() and NOW(), but they change dynamically. What you really need here is something that does not change.

Let’s look at two workarounds that can help you out with this problem.

Continue reading “Add the Current Date to a Sheet When Data Is Added So That The Date Does Not Change(Static) – Google Sheets”

How to Get Something from Google Sheets and Display it in the Sidebar in Google Apps Script

What if you want to get a value or a range from Google Sheets and show it in your sidebar using Google Apps Script?

First you will need to get the value or range by using Googles server-side script. Then you will have to display it client-side in your HTML document.

Documentation on getting the server-side and client-side talking nicely to each other is a little vague. Hopefully, this very basic tutorial will help clear things up.

In this tutorial I will also be using Jquery.

Let’s get started.

Continue reading “How to Get Something from Google Sheets and Display it in the Sidebar in Google Apps Script”

Add the Current Date When Data is Added to a Cell(Dynamic) – Google Sheets

A colleague of mine had recently asked me if there was a way to automatically display the day’s date when a cell has data in it without having to use Google Apps Script.

My answer: “Why yes, there is Jim.”

There are two really cool tools that you can use in Google Sheets to get the current date or time and date:

The NOW formula provides a date and time stamp at the time of execution or when the NOW() function is entered into the sheet.

NOW Google Sheets

The TODAY formula provides just the date at the time of execution or when the TODAY() formula is entered into the sheet.

TODAY Google Sheets

That’s all well and good but I want this formula to occur when a user enters something in a cell.

Done:

To achieve this, we can use an IF statement. First, we will state if the cell is empty, then no date should appear. However, if the cell has a value in it, then the date and/or time the value was entered will appear in the corresponding cell.

Here’s the formula:

=IF(A2 ="", "", TODAY())  <<Formula is celll D2

ِAs you can see in the  IF statement we are saying; if there is nothing in cell A2 then don’t do anything, otherwise if it contains a value then add today’s date in this cell, D2.

Now, if you want to have this ready for all rows for when a user adds to your data, then drag the formula all the way down to the bottom of the sheet.

Here is an example:

IF value DATE Google Sheets

Ready to add some data? Here is what is would look like:

Current Date Added When Cell is Entered

The NOW() and TODAY() functions are Dynamic. This means that they will update automatically. To keep these dates from changing, copy the cell and press <CTRL>+<SHIFT>+<V> or paste special> paste as value.

A Warning on NOW() and TODAY()

These two functions are Dynamic and will update constantly. If you are looking to get the date or time of something so that it does not update automatically then check out this tutorial :

Add the Current Date to a Sheet When Data Is Added So That The Date Does Not Change(Static) – Google Sheets

 

 

 

You can do exactly the same thing with the NOW formula. Give it a try.