SOLVED

Help with random generator based on another cell.

Copper Contributor

Ok, so this is going to be oddly specific, but please bear with me. I am using Google Sheets so that my gf can use this doc with me. Here's what we are trying to do.

I am currently deployed overseas in the Middle East, and I want to watch movies with her as much as possible while I've over here. We made a list on google sheets with a list of movies that we WANT to watch. We made it into a fun experience between us by randomly selecting a movie on the list we want to watch. After watching the movie, we will place the date we watched it into a column labeled "Date Watched". Essentially we want to create a random generator but exclude movies that have a date in that column.

Right now, all I have is a random generator that I pulled off these sites that help for the most part. It doesn't exclude the dates, but since our list is short (for now) it's easy to just "reroll" a new title if a movie that we already watched appears.

=INDEX('Movie List'!B3:B21,RANDBETWEEN(1,COUNTA('Movie List'!B3:B21)),1)

To give a bit more detail, the movie titles are in Column B, and the Date Watched is in Column F. Both starting in Row 3.

 

I figured it might be possible to do an IF statement somewhere? IF the value returned, has a correlating value in another cell, do the formula again?


Any and all help would be GREATLY appreciated. 

Dnykato_0-1624399423033.gif

 

8 Replies
best response confirmed by Dnykato (Copper Contributor)
Solution

@Dnykato 

 

Another approach would be to use FILTER to create a second list of the movies, specifically all those where the date column is blank. Then run your random numbers against that derived list.

 

The function would look something like this: =FILTER("ListOfMoves","Dates"="")  Just substitute the appropriate references for the "ListOfMovies" and "Dates"...

Ohhh ok, I'm liking where this is going, how would I incorporate this into my sheet? would this be a second "sheet" and run my index off that second sheet? Or would I be able to include this into my original formula?

@Dnykato 

 

I've attached a sample file in Excel. I think the same can be done in Google Sheets. (I"ve verified that the FILTER function works there, so syntax is probably very much the same if not identical)

 

In this sample, I just kept the filtered list adjacent to the longer original list. It could be a separate sheet in the same workbook, but needn't be. And you can run your random -- I didn't do that -- in column E. Then just enter the date (or just enter anything: "watched" "we loved this" "let's watch again") under "Viewed"

 

The sheet is attached; here's an image with the formula off to the right.

mathetes_0-1624481094526.png

 

I just tried it out! I created another column next to the Movie list, created the filter, used my random (index) and selected the filtered list, and then hid the column. IT WORKS!. This is exactly what I need!. Thank you SO much for you help!
I wonder if I'm allowed to post another question on here. If not, I'll make another post, but I just realized that the value shown on my "random" generator, is different for mine and her computer. If we both are viewing the sheet, we see different values. Any ideas off the top of your head? Thank you again!

This forum is only for Excel questions; to the extent your question has to do with pre-marital relationship counseling.....
Well, OK, here's an idea: You could take turns being the randomizer and work on trusting that the other has, you know, really gone with the computer rather than picking the one he/she really wants to watch. ;)

mathetes_0-1624539288391.png

 

HA!. Yes, that's what we have been doing, there are times where I feel like it's somewhat improbable that her "random" generated movies are always the ones she put on our list...

Thanks again for your help! I really do appreciate it. It is exactly what I needed. I was definitely overthinking it.
Whereas I'm sure that when you run the random pick it always "just happens" that Rambo or Jason Bourne are the pick.

On Excel: one of the fun things about Excel is that there almost always two or three ways to accomplish a given task. It's a very versatile tool.
1 best response

Accepted Solutions
best response confirmed by Dnykato (Copper Contributor)
Solution

@Dnykato 

 

Another approach would be to use FILTER to create a second list of the movies, specifically all those where the date column is blank. Then run your random numbers against that derived list.

 

The function would look something like this: =FILTER("ListOfMoves","Dates"="")  Just substitute the appropriate references for the "ListOfMovies" and "Dates"...

View solution in original post