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.
Google Apps Script: SpreadsheetApp, getUI, HTMLservice,
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 Google’s 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.
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.
The TODAY formula provides just the date at the time of execution or when the TODAY() formula is entered into the sheet.
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:
Ready to add some data? Here is what is would look like:
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 :
Google Sheets Shortcuts Mousepad
Want a fast track to boost your Spreadsheet efficiency? Grab one of these handy Google Sheets Shortcuts mousepads that I created from my store.
We can achieve a random range of numbers in Google Sheets by using the RANDBETWEEN formula. The formula is quite simple to use. Just add your start range and your end range:
=RANDBETWEEN(start range, end range)
For example, if I want to get a random number between zero(o) and 60 I would do the following:
=RANDBETWEEN(0,60)
The result will provide a whole random number somewhere between these two and including these numbers.
If I were to repeat this formula over a reasonable sample, say 300 times, we should see a fairly even spread of numbers occurring a roughly the same frequency, just like in the graph below:
But what if we wanted to have fewer random numbers in our list at the lower or upper end or on both ends?
Google Sheets: TRANSPOSE, arrays, Randomize Ranges
Random Combinations Without Repetition Using Arrays, TRANSPOSE and Randomize Ranges
Say you have a list of 30 people and a 30 list of groups. After every half hour for six hours the people must change to another group, but they cannot go back to a group they have already been in.
How can we schedule 12 sessions where every person can randomly go to another group without going to the same group twice?
This is pretty much the same issue I face when scheduling my teachers to proctor exams randomly each quarter for different classes. The rules I need to follow are:
No teacher should proctor the same class twice.
Assignment to proctor a class should seem random.
The teacher that teaches the class cannot proctor their own class.
Each week has an exam over the term. The term runs for 8 weeks plus a final requiring a total of 9 proctor sessions.