samedi 15 juin 2019

How to generate a random number within a range only once?

I want to randomize numbers in a range between x and y. The problem is, while the random numbers DO get generated, Excel generates the numbers again, each time I make a change in the spreadsheet.

The purpose of this question is for the sake of generating realistic-looking ID Numbers, basically, for showing a group of students how to generate a range of ID numbers in Excel for a Mail Merge, later on. However, I don't want them to panic, so, I want to make the Generated Numbers be generated only once. For instance, let's say that =RANDBETWEEN(20,45) generates 31 for one cell, I want that particular cell to retain that value. In addition, I also want to demonstrate to students who want to go one step further, how to insert a string prior to the Numbers. For example, "Case: " (without quotes), followed by the generated value. Some students even asked how to add multiple generated numbers, separated by dashes.

The code I use: =RANDBETWEEN(20,45) .

As mentioned, I only want the numbers to be generated once. Instead, every time I modify the spreadsheet, the values change.




Aucun commentaire:

Enregistrer un commentaire