Members-only tutorial
Watch the video and get the practice sheet with membership.
About this Tutorial
Sheet Resources
Featured Formulas
Video Transcript
<div> Hi. In this video I'm going to show you five different ways to generate random numbers. We're going to do it off of Google Sheets. We're gonna do two within formulas, and then we're gonna do two that are scripts. So get ready. This is gonna be fun. So if you wanna generate a number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab , we usually can do something like we can generate random numbers in Google.<br><br>if you can spell random number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab , Google has this great random number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab generator. You can generate a number between Discover how to generate numbers between specific values using Google Sheets. Opens in new tab any numbers, like 101, whatever that number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab is, generate, and it'll give you a number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab . Great.
Now this is pretty simple. If we have wifi, we can just copy paste that number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab right in and create a gener and generate a completely random number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab .<br><br>But sometimes we want to do this within Google. And we can do that by just hitting the equal sign rand and having these parentheses. And we get a pretty random number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab here. It's actually a number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab that is between zero and one. What's interesting about this is that then you can take this and multiply it by, let's say a hundred.<br><br>Now we're gonna get a weird number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab , like 13 point blah, blah, blah.
But we can round it, we can say, and now we're gonna get a number between Discover how to generate numbers between specific values using Google Sheets. Opens in new tab one and 100 every time because we always get a number between Discover how to generate numbers between specific values using Google Sheets. Opens in new tab zero and one. We multiply it by a hundred. We're always gonna get a number between Discover how to generate numbers between specific values using Google Sheets. Opens in new tab zero and 100 now. But if you're really, if your real need here is absolutely to pick a number between Discover how to generate numbers between specific values using Google Sheets. Opens in new tab some number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab and another number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab we can use ran between, we can just go into the cell equal ran between, and what we're doing is we're gonna say between one.<br><br>20, let's say we're kind of like rolling a 20 sided dye.
We can copy paste this and we can get a new number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab every time. But if you notice this, rand is also changing. What's going on is that these two are changing. Every time there is an edit, so even if I go back to our random number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab generator here, generate a number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab , copy and paste this.<br><br>The other numbers are changing. The other numbers are changing every single time I edit the sheet. All right. What hap why? Why we might not want that , we want a random number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab and we just want it to stick. So what we've usually done, I've usually done is I'll generate a random number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab .
Sometimes it's a pretty big number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab , something like this.<br><br>And then I will command C and I will shift command V two, copy and paste that number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab . And now see, I ha I'm generating a new number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab every time I'm copying and pacing it, but I'm pacing the values Understand how to copy and paste values in Google Sheets without changing them. Opens in new tab as I go across the sheet. So that's pretty. Symbol, but again, not that best. So one other way we can do random number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab generating is we can go up to Extensions app script Explore how to use Google Apps Script to create custom functions for random number generation. Opens in new tab <br><br>and once this loads, we'll say function Find out how to define and use functions in Google Sheets for generating random numbers. Opens in new tab . My function Find out how to define and use functions in Google Sheets for generating random numbers. Opens in new tab . We can call this generate new number. Number. And here we're gonna do math dot random.
We're gonna hit command S to save, and now all we need to do within a cell is have this generate new number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab . So we go equals generate new number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab . And with the parenthesis it will show up red, but it's okay.<br><br>It's gonna load the data Learn about handling data in Google Sheets when working with random number generation. Opens in new tab . Loading, loading, loading, loading, taking a while to generate our random. . Ah, I see what happened. I didn't return anything. So we gotta do return. So with the function Find out how to define and use functions in Google Sheets for generating random numbers. Opens in new tab , you need to add return here, and now we get a number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab .
And as we edit this, so again, we can take this number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab , copy paste, see the number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab that's generated is not changing.<br><br>So this script, while it may take a little bit of time to get it to come out, we're. we're also still in a decimal number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab , so we can take this number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab and multiply it by 100 command s go back to our number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab and should change 38. But now we need to round it so we can do math floor<br><br>C command S to. and now we have a perfectly good number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab , a totally random number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab that's not going to change as we copy and paste things around. Perfect.
, but whenever we wanna generate a random number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab , we're never really just generating a random number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab . We're doing it for some reason. The reason might be to roll the dice.<br><br>We might be creating a game within a Google sheet. We might be using Google sheets to run a game of d and d of, of sorts or something. Or maybe it is mere. Randomizer For other games like poker players might use Randomizer for their game play. So how do we do this?
How do we create like a custom function Find out how to define and use functions in Google Sheets for generating random numbers. Opens in new tab ?<br><br>This one I really did rename generate a new number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab , and this is actually a custom function Find out how to define and use functions in Google Sheets for generating random numbers. Opens in new tab , but we can create another one. We can say function Find out how to define and use functions in Google Sheets for generating random numbers. Opens in new tab , role, the dice. and we can get two. We, we might want to get some input, like maybe we want a function Find out how to define and use functions in Google Sheets for generating random numbers. Opens in new tab that we say how many sides of the dice we have. We might wanna say 10, or we might wanna say 20.<br><br>So we can have some number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab here. So we can do a numb. Now we have to have these curly brackets to actually run the function Find out how to define and use functions in Google Sheets for generating random numbers. Opens in new tab . And what we're gonna do is we're gonna return. the roll.
How do we get the roll? We do variable sides equals number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab . This is actually needless cause We can actually write this as sides, but we'll just wanna show you how this sort Understand how sorting can affect your random number generation in Google Sheets. Opens in new tab of works and what we can do then.<br><br>We need to do the roll variable. The roll equals math, floor, math, random times, sides. So now every time we roll the dice, we're gonna get, get a number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab . That number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab is gonna be the number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab of sides, which is just multiplying this random number Learn how to generate random numbers in Google Sheets with simple formulas. Opens in new tab and getting this floor, and we get the return, which is the roll.<br><br>So let's try this out.
Roll the, And we're gonna go equals roll the dice with 2120 sided dice.<br><br>Get an error Get tips on troubleshooting common errors in Google Sheets related to functions. Opens in new tab . Oh, I misspelled random, not Randy. Om random.<br><br>There we go. So now we rolled a 20 sided dice. Maybe we roll a 40 sided. , maybe we roll a 10 sided dice<br><br>and now we can even roll a two-sided dice. And that was five ways to generate random numbers. Hope you enjoyed this video.</div>