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:
In this episode of GWAOw!!! we look at Insert Special Characters by Sheets Help.
About Insert Special Characters for Google Sheets.
As the name suggests, the Insert Special Character Add-on allows you to access the complete list of special characters like maths symbols, shapes and arrows, currency symbols, dingbat and Greek and Coptic symbols from the sidebar of your Google sheets.
This is all accessible from the convenience of the sidebar within your selected Google Sheet.
The Insert Special Character Google Workspace Add-on comes with some handy features. You can:
Modify the colour and size of the characters before installing them.
Insert Multiple characters into one cell.
Filter the character list by:
Arrows
Geometric Shapes
Currencies
Maths Symbols
Dingbats
Greek and Coptic Symbols
Use the search bar to search for a specific character.
Pricing
The add-on comes with a 7-day free trial followed by a very reasonable one-time $7 purchase, but…I spoke to Adam from Sheets Help and managed to get you 20% off.
I don’t know how long the offer will last so I recommend that if you find this Add-on useful, take advantage of the discount while it is still available.
Use the code SPECIAL20 at checkout to get the discount. You can find the code in the description below this video.
About Sheets Help
Along with their recent publication of the Google Workspace Add-on Insert Special Characters for Google Sheets, Sheets Help provides a wide variety of tutorials, tips and tools to help you with your next project.
I need to create a lot of sample data for tutorials and courses. One of the things that I needed for a recent course I am building was to generate a column containing dummy passwords in Google Sheets. Each password needed to consist of letters, numbers and characters.
Until recently, this task would have been relegated to Google Apps Script.
However, with the recent introduction of the LAMBDA function (Well, at the time of writing this anyway), we can do so much more with our Google Sheets.
Before we dive into the formula, it’s important to understand that these ‘passwords’ or random strings of characters are dynamically generated. This means every time you update a cell or reload your Google Sheet the characters in each cell will change.
So once you generate your passwords, copy the range and paste the values back in (Ctrl + c, Ctrl + Shift + v). This way only the values remain.
If you just want to grab the formula and be on your way, you can copy it from the section below. However, if you want to learn how it all works, read on for a breakdown.
Table of Contents
The Password Maker Formula
Note in the formulas below there are three parameters that you can change:
[NumChars]: The number of characters in each string in each cell.
[NumRows]: The number of rows to produce the random string of characters in.
[NumCols]: The number of columns to produce the random string of characters in.
Replace the items in the square [] braces with your own values.
For example, if we wanted to generate a matrix of passwords 4 rows deep, 5 columns wide and with each cell containing 12 random characters we would do this:
To quickly change the formula to produce only a certain subset of characters, you will need to delete the desired characters from the string contained in the MID function on line 14 of the example above.
You will also need to change the second argument of the RANDBETWEEN function to the length of your new string of characters.
Hint! You can quickly count the string of characters by copying the characters in the formula (including the double quotation marks on each end) and pasting it inside a LEN function. For example:
=LEN("GOAT!1234") = 9
Check out the sample sets below and their letter lengths for convenience.
In this section, we will walk through the process of creating the random string generator. Not only does this help to provide an understanding of how the formula works, but it also gives you some insight into a good workflow for building your own complex formulas in Google Sheets.
This function takes two arguments, the starting value and the end value. Let’s input our range:
=RANDBETWEEN(1,91) = A random number between 1 and 91
It will dynamically return a random value between 1 and 91.
Note! The Google Sheets RANDBETWEEN function updates dynamically. This means that every time you apply a change to your sheet the random number will change.
MID
We can then use the MID function to find a character in the string at a designated position. For us, this position will be determined by the number that our RANDBETWEEN function returns.
MID takes 3 variables:
The reference string or cell.
The start index in the cell that contains the string.
The length of characters to extract.
So in our example, our formulas would look like this:
=MID(B1, RANDBETWEEN(1,91),1) = A random character from our string.
Where B1 in our example is the string of characters.
You can see in the example above that the formula randomly selected the pipe (|) characters from the string in B1.
Set a Sequence of n Columns
Let’s work on another part of the formula now. We need a way to create a string of random characters at any length we desire – we’ll call this n.
The first part of this process is to generate a row that is n cells wide.
This can be achieved with the SEQUENCE function. With this function, we can generate a range or matrix of values at any row or column width.
Number of columns: We will assign our desired n length here.
The Starting value (optional): This will always be 1 in our formula.
The Step between each value (optional): This will also always be one in our formula.
Let’s say we want to create a formula one row deep and five columns across:
=SEQUENCE(1, 5, 1, 1) = Array [1, 2, 3, 4, 5]
Map a Random Character to Each Sequence Item
Now that we have our sequence, we can map a random character to each item in the sequence. To do this we use the Google Sheets MAP function. This is a helper function of the LAMBDA function set.
The MAP function allows you to traverse an array and modify each item in the array. For us, we are going to apply a random character to each item in the sequence we generated.
MAP can take a number of arrays or ranges as its first argument and then a LAMBDA function as its last argument.
The nested LAMBDA array takes an iterator item argument. This represents the current cell the item is modifying as it works through each item in the range. We need to add this argument even if we don’t use it in our formula.
The second LAMBDA argument is the formula expression. That is, what we are doing to change the value in each of the cells.
The delimiter – This is the value we want to use to separate each cell item when we combine it into a string. In our example, we don’t want to separate the characters so we will leave this as an empty string.
The array – This will be the array we generated in the previous section.
In the example above we have created an array two columns wide and five columns deep with a random password length of 5 characters (See the second argument of the SEQUENCE)..
Conclusion
This password generator is a really helpful tool for templating spreadsheets to create examples or quickly generate a password or random string of characters for codes.
As we mentioned above, the passwords will change each time you update the sheet. The best solution to provide a static password would be to use a bit of Google Apps Script Magic connected to an onEdit() function similar to this tutorial:
For whatever reason, sometimes we just need a list of alphanumeric letters and numbers like this “0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ” to run down a column or across a row, or just all packed into one string of text in a cell in our Google Sheet.
I most commonly use an alphanumeric list to index data or use an alphanumeric string in the random assignment of a value.
In this tutorial, we will cover 4 ways to achieve this. Some approaches have different benefits than others. While two of the approaches even use the new Google Sheets LAMDA function.
If you just want to dive in, copy the formula, and get back into your own project, click on the link to the main numbered headers in the table of contents below. You can copy the formula into your project using the copy symbol in the dropdown menu of the formula bar and selecting the formula you want.
Each formula type can be:
Transposed to run across a row.
Join into a string in a cell.
Set to lowercase.
Extended to include a lowercase option.
The How it Works sections are not mandatory reading but might be helpful if you plan to extend the formula or are simply curious.
Imagine you have a Google Sheet tab containing a course worth of hundreds of students sorted into classes or groups. After each exam, quiz or assignment, your teacher for each class needs to enter in the grades.
To make life easier for your teachers, we want to create a summary page where we can click on their class and be navigated directly to their group.
We don’t want to have to manually create a link for each location so we are going to write a formula to do the work for us.
Now, the formula is a little complex. So first off, we will generate our list of classes and add a separate section start link for each one. Then we will combine the two together to generate a single formula that gets all the unique sections and provides a link for each one.
If you are playing along, you can grab a copy of the starter sheet here: