Tip #8: Using RAND and RANDBETWEEN functions to generate random data sets

Tip #8: Using RAND and RANDBETWEEN functions to generate random data sets

Have you ever spent hours working on a sample data record for a demonstration? We're here to show you how to do it in less time. If you want to generate a sample data set for a demonstration, or just to learn how a pivot table works, using the RAND and RANDBETWEEN functions can be a savior. With these functions, you can generate random data that includes text, numbers, dates, and even cell references.
 


How to use them 

The RAND function generates random values with no defined limits, while RANDBETWEEN, as its name signifies, returns random values within a specified range of values. Let's see how they can be used to generate various data sets.
 

Random numbers 

To get random numbers, you can use these functions the default way (i.e. without any special changes). 



Example
=RAND() returns float values between 0 and 1
=RANDBETWEEN(10;100) returns values between 10 and 100, inclusive
 

Random text values 

To get random text values (letters of the alphabet), you can use the RANDBETWEEN function in combination with the CHAR function. The numbers given as the input must be between 65 to 90 for capital letters and 97 to 122 for small letters.



Example
=CHAR(RANDBETWEEN(65;90)) returns capital letters
 

Random date values 

To get random date values, you can use the RANDBETWEEN function and specify the start and end dates. If the result is returned in the form of a date-time serial number, apply the Date format to the cells to get the desired result.



Example
=RANDBETWEEN("1/2/2022";"19/2/2022") returns dates from the given date range
 

Random cell references

To get random cell references as the result, use RANDBETWEEN function in combination with ADDRESS function. You can also choose the reference type to be absolute or relative.



Example
=ADDRESS(RANDBETWEEN(1;100);RANDBETWEEN(1;5);4) returns random cell references between columns A to E and rows 1 to 100.
 

Random values from a list 

If you wish to get random values from a specified data set or range of values, you can use RANDBETWEEN in combination with INDEX function.



Example 
=INDEX(L2:L8;RANDBETWEEN(1;5);1;1) returns random values from the cell range L2:L8.
 
Apart from the above mentioned functions, you can also use RANDARRAY and SEQUENCE to get an array of random and ordered data respectively! Are there any specific features you'd like to learn more about in future tips? Tell us in the comments below! 
 
Join the Zoho Sheet community and stay up to date on the latest features, interact with fellow users, and learn from the team behind Zoho Sheet. For more such exciting tips follow our Tips and Tricks forum.


            Zoho Marketing Automation
                    • Sticky Posts

                    • Tip #15: Stop guessing and start estimating with Zoho Sheet's Goal Seek

                      Goal Seek is an ideal spreadsheet tool for devising estimates, as it helps you retrieve your desired output value when the input values are not known. In other words, Goal Seek does back-solving to find input values once you've provided an output value.
                    • Tip #10: 3 helpful ways to use data validation in your spreadsheet

                      Data validation in spreadsheets makes data entry processes more efficient, while helping reduce inconsistencies and errors in your data sets. In this article, we'll look at three ways you can use data validations to create useful dropdown lists in your
                    • Tip #8: Using RAND and RANDBETWEEN functions to generate random data sets

                      Have you ever spent hours working on a sample data record for a demonstration? We're here to show you how to do it in less time. If you want to generate a sample data set for a demonstration, or just to learn how a pivot table works, using the RAND and
                    • Tip #3: Save your time by replicating formats

                      Formatting helps to create more visually appealing spreadsheets while keeping data organized. Selectively applying formatting options to your work, such as applying fonts, currency formats, or colors, can be time-consuming and repetitive. Replicating formatting guidelines for your work can help remove the burden of applying these menial tasks, which improve overall productivity in your workflow.  Let's say you are collaborating on a spreadsheet with your team and you have to create a combined report.
                    • Tip #1: Handy shortcuts to move around your spreadsheet

                      No matter the application, keyboard shortcuts are always a great way to save time and make you more productive. Here are a few quick key actions you can use in Zoho Sheet to navigate within your spreadsheet. Moving to the next cell (Tab, Enter, Shift+Tab)

                    Zoho Pagesense Resources

                      Zoho SalesIQ Resources



                            Zoho TeamInbox Resources

                              Zoho DataPrep Resources



                                Zoho CRM Plus Resources

                                  Zoho Books Resources


                                    Zoho Subscriptions Resources

                                      Zoho Desk Resources

                                        Zoho Projects Resources


                                          Zoho Sprints Resources


                                            Qntrl Resources


                                              Zoho Creator Resources


                                                Zoho WorkDrive Resources





                                                    Zoho Campaigns Resources

                                                      Zoho CRM Resources

                                                            Design. Discuss. Deliver.

                                                            Create visually engaging stories with Zoho Show.

                                                            Get Started Now