Members-only tutorial
Watch the video and get the practice sheet with membership.
About this Tutorial
Sheet Resources
Featured Formulas
Video Transcript
<div>0:00 This was a very interesting question that I saw, and what it was, was basically we have a name, a bunch of students or people that we have raffle tickets that we've given them.<br>0:12 We have a number Learn about the number data type and its uses in spreadsheets. Opens in new tab of tickets for each person, and we don't necessarily want to do a traditional raffle where Understand how to filter data using the WHERE clause in queries. Opens in new tab , this is how I would set this up, is I would have each name individually, not just the number Learn about the number data type and its uses in spreadsheets. Opens in new tab of tickets, but what they wanted to do is have a display here and say, hey, Andy had one ticket, Dwight<br>0:28 had three tickets, Jim had three tickets, add Jim to give them a ticket.
I just changed this from three to four.<br>0:36 What I would do if I, this is a bit complicated because basically you need to figure out a winner from just this data Explore different types of data you can work with in spreadsheets. Opens in new tab , and we do it.<br>0:44 We actually figured this out with one formula Get familiar with the syntax rules for writing formulas. Opens in new tab here. This is what the formula Get familiar with the syntax rules for writing formulas. Opens in new tab looks like. I'll break this down, but you click this box here, B1, and it will reveal a winner, and every time we click it, it'll reveal a different winner, or it'll pick out a different one.<br>0:58 Might actually be the same winner. Let's see, every time we click it, we get a winner.
And what this is doing is actually, it will edit, it will actually change every single time you add a new ticket.<br>1:12 So let's say we have, actually Andy has two tickets. That edit will also change. So I've added this checkbox Discover how to use checkboxes in your spreadsheets for interactivity. Opens in new tab just to have an edit that's other than adding a name or adding a number Learn about the number data type and its uses in spreadsheets. Opens in new tab of tickets, and it would not be revealed until you want it to be revealed.<br>1:26 So if we reveal it, hey, it's Andy, but then we come in, we're like, hey, Actually, uh, Robin got a ticket.<br>1:33 See, it's changing every time, every time there's an edit to the sheet.
How I would actually do this without this formula Get familiar with the syntax rules for writing formulas. Opens in new tab , I'm going to actually break down this formula Get familiar with the syntax rules for writing formulas. Opens in new tab at the, after I tell you how I would do it, but what I would do is I would say, let's add here, I would just put tickets, and I would<br>1:53 just put Andy, and if Andy had another ticket, I'd put another ticket, and if Jim got a ticket, maybe three tickets and Dwight got a ticket, Dwight, yeah, Dwight, and now we have a list of the number Learn about the number data type and its uses in spreadsheets. Opens in new tab of times actually each person exists, and I would put maybe an index Learn how to use the INDEX function to retrieve data from a specific location. Opens in new tab here, and I can reference Understand how to reference cells and ranges in your formulas. Opens in new tab this and<br>2:13 say, ah, pick a row at random, ah, between, ah, one and however many there are, count all of these, right?<br>2:24 And what it's going to do is this will simply pick one out of this group Find out how to group data for better organization and analysis. Opens in new tab .
And that's how I would do it.<br>2:30 This is a. Fairly simple way to do it. This ran between, though, is going, same thing we have on the other one, it's going to continually update every single time, ah, we change the sheet or edit the sheet, uhm, but you might not want to be adding names here, and you might not want to have to update <br>2:47 this, ah, index Learn how to use the INDEX function to retrieve data from a specific location. Opens in new tab here, like these ranges Explore how to define and use ranges in your spreadsheet calculations. Opens in new tab , so what we did here is we just have a name and number Learn about the number data type and its uses in spreadsheets. Opens in new tab of tickets, and we just come in here and edit the number Learn about the number data type and its uses in spreadsheets. Opens in new tab of tickets.<br>2:59 So, how do we do this? How do we break down this formula Get familiar with the syntax rules for writing formulas. Opens in new tab ?
Well, the, the thing that's wrapping it is this if, uhm, but at the very core of it is this repeat array formula Learn how to apply formulas to entire ranges with ARRAYFORMULA. Opens in new tab , and let's try to build it up.<br>3:17 So what we're doing is repeating text, and we're saying, okay, repeat this text number Learn about the number data type and its uses in spreadsheets. Opens in new tab of times this number Learn about the number data type and its uses in spreadsheets. Opens in new tab of times, and rept, or repeat, is going to get you something like this.<br>3:31 But we've definitely changed it here. We're using an array, and we're also, uhm, adding after the name, an ampersand to sort Discover how to sort your data for better readability and analysis. Opens in new tab of concatenate Understand how to concatenate text strings in your spreadsheets. Opens in new tab two things together, and a, a comma.<br>3:47 So now we have Andy is repeated.
Now we have to, we can also do, say, maybe repeat and And add an and.<br>4:01 And repeat a six, and b six, so it's taking the number Learn about the number data type and its uses in spreadsheets. Opens in new tab of tickets and repeating it. But if you notice, there's, like, an extra, I think, I don't even think we need this here.<br>4:15 So, yeah, now we're just adding and repeat here. But we don't want to have to update all of these, so what we can do is, instead of using repeat a number Learn about the number data type and its uses in spreadsheets. Opens in new tab of times, we can wrap Learn how to wrap text in cells for better visibility. Opens in new tab this with array formula Learn how to apply formulas to entire ranges with ARRAYFORMULA. Opens in new tab .<br>4:26 and I'll see you in one.
And with array formula Learn how to apply formulas to entire ranges with ARRAYFORMULA. Opens in new tab , we need to change each of these single arrays Explore the concept of arrays and how to use them in formulas. Opens in new tab to an array.<br>4:36 Ah, sorry, each of these cells Get to know the different types of cells and their functionalities. Opens in new tab to an array. And now we get this. So each of these are the person repeated the number Learn about the number data type and its uses in spreadsheets. Opens in new tab of times that they appear.<br>4:51 So let's actually format Discover various formatting options to enhance your spreadsheet's appearance. Opens in new tab this all the same so we can nicely see everyone. Let's just change everyone to the same.<br>5:01 Text. See, each person has the number Learn about the number data type and its uses in spreadsheets. Opens in new tab of tickets they exist, have. Pretty cool, right?
But now, how do we combine Learn how to merge cells for better data presentation. Opens in new tab this?<br>5:10 So what we're going to do is around this, we're going to join, we're going to add, I think we add, we don't add a, anything, we just join them together.<br>5:23 And now they are all in one single cell. But, we can't, really pick out one or the other. This is like one big text from Andy to Robin.<br>5:38 We want to be able to pick out one person from this list. So, we're going to wrap Learn how to wrap text in cells for better visibility. Opens in new tab this with split Understand how to split text into separate cells for easier analysis. Opens in new tab .<br>5:47 The text we're going to split Understand how to split text into separate cells for easier analysis. Opens in new tab is everything, the entire join and array from and repeat.
And the delimitator is going to be the one we actually combine Learn how to merge cells for better data presentation. Opens in new tab them with, which is the Now, split Understand how to split text into separate cells for easier analysis. Opens in new tab splits everyone to the right.<br>6:01 So, we need to actually wrap Learn how to wrap text in cells for better visibility. Opens in new tab this with transpose. So, now we have a formula Get familiar with the syntax rules for writing formulas. Opens in new tab that gives us, I hope you can see this, every single person in an, in a column and the number Learn about the number data type and its uses in spreadsheets. Opens in new tab of times as they appear here with tickets.<br>6:28 Now, our only problem on our next page, problem to overcome is, how do we pick someone from this list?
Well, here, we're going to use index Learn how to use the INDEX function to retrieve data from a specific location. Opens in new tab .<br>6:37 And index Learn how to use the INDEX function to retrieve data from a specific location. Opens in new tab is really fun because we can use the reference Understand how to reference cells and ranges in your formulas. Opens in new tab , the entire, uh, array that we've just now created. We can now pick a row.<br>6:45 Now, if we pick one, it's just going to show us Andy, and it shows us, actually, here, the answer right above, next to the C.<br>6:52 If we pick two, three, it's Dwight, four. So, now we just need to figure out how to pick a random number Learn about the number data type and its uses in spreadsheets. Opens in new tab .<br>6:58 So we have rand, but we also have rand between.
Uh, rand, we could multiply, rand is going to give us a number between Explore how to generate random numbers within a specified range. Opens in new tab zero and one.<br>7:06 It's going to be a random number Learn about the number data type and its uses in spreadsheets. Opens in new tab , like, tiny little thing, but we want an integer. So we use rand between, and the low is one, but the high is going to be count all, and we're going to count however many are in this array.<br>7:23 So we're going to need this split Understand how to split text into separate cells for easier analysis. Opens in new tab . actually also already from transpose all there. We need all that again.
So we want to count how many are there.<br>7:43 So now we're getting, in one cell, we're indexing a random number Learn about the number data type and its uses in spreadsheets. Opens in new tab from that list, and every single time we edit the, uh, page, it's going to change.<br>7:57 So what we want to do is we want to wrap Learn how to wrap text in cells for better visibility. Opens in new tab it with, if, and choose this checkbox Discover how to use checkboxes in your spreadsheets for interactivity. Opens in new tab , B1, which is just going to give us a true-false.<br>8:06 And if it's true, we want to show it, but then at the very end, we want to add another comma, and if false, we want to add some text, like click.<br>8:16 So now if we uncheck this, now both of these are click.
This one says click checkbox Discover how to use checkboxes in your spreadsheets for interactivity. Opens in new tab , because we added it here.<br>8:24 We could, and actually we did this here, is instead of using all of this count all. We can use a sum, and we're just going to sum up the number Learn about the number data type and its uses in spreadsheets. Opens in new tab of tickets.<br>8:40 Oops, there we go. And in that case, it's a little bit smaller formula Get familiar with the syntax rules for writing formulas. Opens in new tab , but it's exactly the same, because this sum is the same as count all of everything in that list.<br>8:56 And we still have false, we need to add, I think we had an extra. There we go.
And now it's back.<br>9:05 So we have the same formula Get familiar with the syntax rules for writing formulas. Opens in new tab in each, and we broke it down, so you can now see that we can hold a raffle with just the name and number Learn about the number data type and its uses in spreadsheets. Opens in new tab of tickets, and we don't have to do this tickets as their name and pick one from there.<br>9:18 But this one I think is a little bit simpler, it's just to list however many people there are. If they have a list, add their name, if they have a ticket, add their name, add a name for each ticket they get.<br>9:29 This, however, keeps the data Explore different types of data you can work with in spreadsheets. Opens in new tab very tight and secure.</div>