Chapter in this post:
Generate a random number in Microsoft Excel or output a random value in Apple Numbers; it's not difficult at all. With the right combination of function, formula and syntax, both spreadsheet apps output a random number with or without decimal places, rounded or not, and in an individually selected range from a lowest to a highest number. In the following you will find the commands for the individual cells to generate random numbers with Excel and Numbers.
The syntax = ZUFALLSZAHL () works, among other things, in Excel for Office 365 on the Windows PC, Excel for Office 365 on the Apple Mac, Excel Online, Excel 2019 and in other versions of the software. Microsoft points out that the Mersenne Twister algorithm has been used to create random values since the 2010 version. Whoever wants to read about it can do so, among other things on Wikipedia to do. Here are the options for creating random numbers in the table:
Create a random number between 0 and 1 (decimal number)
= RANDOM NUMBER ()
Generate Excel random number between 0 and x (replace x with number!)
= RANDOM NUMBER () * x
Create rounded decimal number or whole number in the range (a is the number of decimal places; can also be 0)
= (ROUND (RANDOM () * x; a))
The same thing, only that the number range does not start with 0, but with a self-selected lowest number y (replace y with a number that is smaller than x!)
= (ROUND (RANDOM () * (xy) + y; a))
Granted, the syntaxes or formulas listed above are not particularly descriptive. I'll take the penultimate and last example for the explanation. If you want a number without decimal places between 0 and 10, it looks like this:
= (ROUND (RANDOM () * 10; 0))
If the number should have two places after the decimal point, it looks like this:
= (ROUND (RANDOM () * 10; 2))
If you want a number between 50 and 100 that has no decimal places, then enter this:
= (ROUND (RANDOM () * (100-50) +50; 0))
The same commands are used in the standard spreadsheet for macOS on the Apple Mac, iMac and MacBook. So if you're in Numbers want to generate a random number, you can use the same inputs as in Excel. Only the visual appearance of the input is slightly different, at least much more graphical. In Numbers, it is easier to see which values belong to which command because not only brackets are displayed, but bracketed ranges. This makes it easier for beginners if they want to get by with complex inputs. There is also a syntax selection and explanation on the right by default.
Jens has been running the blog since 2012. He appears as Sir Apfelot for his readers and helps them with problems of a technical nature. In his free time he drives electric unicycles, takes photos (preferably with his iPhone, of course), climbs around in the Hessian mountains or hikes with the family. His articles deal with Apple products, news from the world of drones or solutions for current bugs.