Write a Formula to Generate a Random Letter
Transcript
In this video, both partners will write a formula that generates a random letter.
A formula is a set of instructions that performs a specific calculation on numbers or text in your spreadsheet.
Formulas can help you do complex math or time-consuming tasks easily and accurately.
The formula for your word game will place a random letter into a cell.
Random means that it could be any letter.
And the letter will change each time you open or refresh your spreadsheet.
Your formula will contain two functions.
A function is a preset command you can use to quickly perform a calculation or task.
Functions are like shortcuts: they are programmed to do a calculation automatically, so you don’t have to write out all the steps to complete that task.
Functions are often used inside formulas to save time.
Your random letter formula will use two different functions: the CHAR function and the randbetween function.
The CHAR function instructs your spreadsheet to give you a character.
Characters are symbols like letters and punctuation marks.
And the randbetween function will tell your spreadsheet that the character must be randomly selected from between two other characters.
It’s time to write your formula! Both partners will write the same formula in different cells.
Decide which partner will write the formula in A2, and which will write it in A3.
All formulas begin with an equals sign.
Type equals to start your formula.
Next, type C-H-A-R and select the CHAR function.
A left parenthesis will appear, so that you can give your next instruction.
Now, type R-A-N-D and select the randbetween function to get a random character between two numbers.
But you are asking for a letter, not a number! Luckily, there is a code that can help.
It is called the ASCII, the American Standard Code for Information Interface.
Each character has its own number in ASCII.
The number for a capital letter A is 65, and the number for a capital letter Z is 90.
The formula for your word game needs to pull a random letter between A and Z.
So, type 65 for “A,” a comma, and 90 for “Z.” Now, check your formula.
It should look exactly like this: Press Enter to complete your formula.
A random letter from the alphabet will appear in this cell.
Refresh your browser to make a new random letter appear.
Congratulations, you have written a formula to pull a random letter! Move on to the next video to set up your word game.
Now, it’s your turn: Type the equals sign to begin your formula, Add the CHAR function to create a character, Add the randbetween function to make the character random, Add 65, comma 90 to make it a letter from the alphabet, And press “Enter” to complete the formula.
Instructions
- Type = to begin your formula.
- Add the CHAR function to create a character.
- Add the randbetween function to make the character random.
- Add 65, 90 to make it a letter from the alphabet.
- Press Enter to complete the formula: =CHAR(randbetween(65,90)).