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.

    • Sticky Posts

    • 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) You can use the Enter key to move to the cell below, from edit mode, while the Tab and Shift+Tab keys help you move to cells on the right and left respectively. Once you're done filling a row using the Tab key, pressing Enter will take you
    • Tip #7: Four things you didn't know you can do with Conditional Formatting

      Conditional formatting helps you highlight and visualize data in your spreadsheet based on provided rules. Zoho Sheet offers three types of conditional formatting: Classic, Color Scales, and Icon Sets. If you're already familiar with how Conditional Formatting works, here are some bonus tips for Classic formats: Customize rules with formulas Zoho Sheet allows you to create personalized rules based on formulas. For example, in a task list you can use customized formulas to highlight tasks which are

    Zoho CRM Plus Resources

      Zoho Books Resources


        Zoho Subscriptions Resources

          Zoho Desk Resources

            Zoho Projects Resources


              Zoho Sprints Resources


                Zoho Orchestly Resources


                  Zoho Creator Resources