Excel Functions Tutorials
- Excel Tips
- Excel vs Access
- Excel Rows vs Columns
- Apple Numbers vs Excel
- 3D Reference in Excel
- Absolute Reference in Excel
- Mixed References in Excel
- Excel Reference to Another Sheet
- Array Formulas in Excel
- Arrays in Excel VBA
- Auto Numbering in Excel
- AutoFit in Excel
- AutoCorrect in Excel
- AutoSave in Excel
- AutoRecover in Excel
- Bullet Points in Excel
- Break Links in Excel
- Barcode in Excel
- Change Case in Excel
- CAGR Formula in Excel
- Calculate Age in Excel
- Calculate Percentage in Excel Formula
- Cell Reference in Excel
- Checklist in Excel
- Circular Reference in Excel
- Column Sort in Excel
- Column Lock in Excel
- Move Columns in Excel
- Custom List in Excel
- Consolidate in Excel
- Combine Cells in Excel
- Compare Two Columns in Excel
- Compare and Match Columns in Excel
- Compound Interest Formula in Excel
- Convert Columns to Rows in Excel
- Convert Date to Text in Excel
- Convert Numbers to Text in Excel
- Convert Text to Numbers in Excel
- Convert Excel to CSV
- Count Characters in Excel
- Count Rows in Excel
- Count Unique Values in Excel
- Countif not Blank in Excel
- Create Templates in Excel
- Family Tree in Excel Template
- Custom Number Format in Excel
- Delete Row Shortcut in Excel
- Divide in Excel Formula
- Drop Down List in Excel
- Dynamic Tables in Excel
- Dashboard in Excel
- KPI Dashboard in Excel
- Date to Text in Excel
- Date Format in Excel
- Database in Excel
- Delta Symbol in Excel
- $ Symbol in Excel
- Excel Column to Number
- Edit Drop-Down List in Excel
- Equations in Excel
- Exponents in Excel
- Excel Extensions
- Excel Translate
- Excel Not Responding
- Excel Find and Replace
- Find and Select in Excel
- Excel Subtraction Formula
- Excel Formula for Grade
- Excel as Calculator
- Excel Formula Not Working (Updating)
- Excel Table Styles & Formats
- Excel vs Google Sheets
- External Links in Excel
- Excel Alternate Row Color
- Excel Worksheet Tab
- Extract Number from String Excel
- Evaluate Formula in Excel
- Find Duplicates in Excel
- Finding Links in Excel
- Filter Shortcut in Excel
- Formatting in Excel
- Format Numbers to Millions & Thousands in Excel
- Format Phone Numbers in Excel
- Formula Errors in Excel
- Fractions in Excel
- Frequency Distribution in Excel
- Group in Excel
- Group Worksheets in Excel
- Group Columns in Excel
- Hide Formula in Excel
- Hiding a Column in Excel
- Highlight Every Other Row in Excel
- Highlight Duplicates in Excel
- How to Create a Formula in Excel?
- How to Create an Excel Spreadsheet?
- How to Add Text in Excel Formula?
- How to Create Dashboard in Excel?
- How to Copy Sheet in Excel?
- How to Delete Pivot Table?
- How to Calculate Percentage Increase in Excel?
- How to Multiply in Excel Formula?
- How to Unhide Columns in Excel?
- Insert Date in Excel
- Insert Calendar in Excel
- Import Data into Excel
- Insert Comment in Excel
- Insert Hyperlinks in Excel
- Insert Multiple Rows in Excel
- Insert Row Shortcut in Excel
- Insert New Worksheet in Excel
- Insert (Embed) an Object in Excel
- Insert Image in Excel Cell
- Insert Page Break in Excel
- Line Breaks in Excel
- Linear Interpolation in Excel
- Leading Zeros in Excel
- Last Day of the Month in Excel
- Logical Operators in Excel
- Lookup Table in Excel
- Mortgage Calculator in Excel
- Moving Average in Excel
- Not Equal to in Excel
- Numbering in Excel
- Name Manager in Excel
- Page Numbers in Excel
- Page Break in Excel
- Personal Budget Template in Excel
- Project Management Template in Excel
- Percentage Difference in Excel (Increase / Decrease)
- Pivot Table Calculated Field & Formula
- Pivot Table Sort
- Pivot Table From Multiple Sheets
- Print Comments in Excel
- Print Excel Gridlines
- Print in Excel
- Print Preview in Excel
- Print Area in Excel
- Print Titles in Excel
- Print Labels From Excel
- Project Timeline in Excel
- Protect Sheet in Excel
- Ratio in Excel Formula
- Random Numbers in Excel
- Randomize List in Excel
- Refresh Pivot Table in Excel
- Relative References in Excel
- Remove Blank Rows in Excel
- Remove Duplicates in Excel
- Remove Duplicates from Excel Column
- Remove Hyperlinks in Excel
- Remove Space in Excel
- Remove Leading Spaces in Excel
- Remove Watermark in Excel
- Row Limit in Excel
- Rows and Columns in Excel
- Rows to Columns in Excel
- Row Header in Excel
- Search in Excel
- Search For Text in Excel
- Share an Excel Workbook
- Shortcut to Merge Cells in Excel
- Show Formula in Excel
- Split Cells in Excel
- Separate Text in Excel
- Strikethrough in Excel
- Strikethrough Text in Excel
- Sum by Color in Excel
- Subscript in Excel
- Superscript in Excel
- Themes in Excel
- Timesheet Calculator in Excel
- Top 20 Keyboard Shortcuts in Excel
- Unmerge Cells in Excel
- Uppercase in Excel
- Word Count in Excel
- Word Cloud in Excel
- Watermark in Excel
- Weighted Average in Excel
- Wildcard in Excel
- Financial Functions in Excel (17+)
- Logical Functions in Excel (15+)
- TEXT Functions in Excel (29+)
- Lookup Reference in Excel (44+)
- Maths Functions in Excel (52+)
- Date and Time Function in Excel (22+)
- Statistical Function in Excel (50+)
- Information Functions in Excel (5+)
- Excel Charts (48+)
- Excel Tools (98+)
- VBA (162+)
Random numbers in excel are used when we want to randomize our data for a sample evaluation, these numbers generated are absolutely random, there are two inbuilt functions in excel which gives us random values in cells, =RAND() function gives us any value from range 0 to 1 whereas another random function =RANDBETWEEN() takes input from user for a random number range.
Table of Contents
- How to Generate Random Numbers in Excel
- Generate Random Numbers in Excel for more than One Cell?
- How to Stop Recalculation of Random Numbers in Excel?
Generate Random Numbers in Excel
- Randomness has many uses in science, art, statistics, cryptography, gaming, gambling, and other fields.
- Generating Random numbers in excel are important because many things in real life are so complicated that they appear random. Therefore, to simulate those processes we need random numbers.
Many randomizing devices such as dice, shuffling playing cards, and roulette wheels, seem to have been developed for use in games of chance. However, these cannot be used for digitized files. That is why we need to have tools for generating random numbers in excel.
How to Generate Random Numbers in Excel?
There are number of methods to generate a random number in excel. We will discuss the two of them – Rand() and Randbetween() Functions
#1 – RAND() Function
To generate a random number in excel between 0 and 1(excluding), we have RAND() function in Excel.
RAND() functions return a random decimal number that is equal to or greater than 0 but less than 1 (0 ≤ random number <1). RAND recalculates when a worksheet is opened or changed (Volatile Function).
RAND function returning the value between 0 and 1 (excluding).
We just need to type ‘=RAND()‘ in the cell and press Enter. The value will change every time when any change is made in the sheet.
How to Generate Random Numbers in Excel for more than One Cell?
If we want to generate random numbers in excel for more than one cell, then we need
- First, make a selection of the required range, then type =’rand()‘ And pressing ‘Ctrl+Enter’ will give us the values.
How to Stop Recalculation of Random Numbers in Excel?
As RAND function recalculates if any change in the sheet is made, we need to copy and then paste the formulas as values if we do not want values to be changed every time. For this, we need to paste the values of the RAND() function using Paste Special so that it would no longer be a result of ‘RAND ()’ function and will not recalculate.
To do this,
- We need to make the selection of the values.
- Press Ctrl+C to copy the values.
- Without changing the selection, Press Alt+Ctrl+V to open the ‘Paste Special’ Dialog box.
- Choose ‘Values’ from the options and click on ok.
Now we can see, the value in the formula bar is the value itself not the rand() function. Now, these are only values.
There is one more way to get the value only not the function as a result but that is only for one cell. If we want the value at the very first time, not the function, then the steps are:
- First, type =rand() in the formula bar, then press F9 and hit ‘Enter’
After pressing F9, we get the value only.
Value from a Different Range other than 0 and 1 using RAND()
As RAND function returns a random decimal number between 0 and 1 only, if we want the value from a different range then we can use the following function:
Let ‘a’ be the start point
And ‘b’ be the endpoint
The function would be ‘RAND()*(b-a)+a’
For example, we suppose 7 as ‘a’ and 10 as ‘b’, then the formula would be ‘=RAND()*(10-7)+7‘
As the name of the function indicates, this function returns a random integer between given integers. Like RAND() Function, this function also recalculates when a workbook is changed or opened (Volatile Function).
The formula of the RANDBETWEEN Function is:
Bottom: An integer representing the lower value of the range.
Top: An integer representing the lower value of the range.
To generate random numbers in excel for the students between 0 and 100, we will use the ‘RANDBETWEEN’ function.
First, we need to select the data, then type the formula i.e =RANDBETWEEN(0,100) and hit Cntrl + Enter. You can prefer the below-given screenshot.
As values will recalculate, we can use Alt+Ctrl+V to open the ‘Paste Special’ Dialog box to paste as Values only.
Follow the steps given below in the screenshot.
Like RAND() function, we can also use the method of typing the RANDBETWEEN function in the formula bar and pressing F9 to convert the result into value and then pressing Enter.
Things to Remember
- If the bottom is greater than the top, the RANDBETWEEN function will return #NUM!
- If either of the supplied arguments is non-numeric, the function will return #VALUE!
- Both RAND() and RANDBETWEEN() function are a volatile function (recalculates), hence adds to the processing time and can slow down workbook.
Random Numbers in Excel – Project 1
We can use the RANDBETWEEN() function for getting random dates between two dates.
We will be using 2 dates as the bottom and top arguments.
We need to copy down the formula using the shortcut (Ctrl+D) after making the selection.
We can change Start (D1) and End Date (E1) to change the top and bottom value for the function.
Random Numbers in Excel – Project 2 – Head and Tail
To randomly choose head and tail, we can use the CHOOSE function with RANDBETWEEN function.
We just need to copy the formula into next and next cell every time in the game and ‘Head’ and ‘Tail’ will come randomly.
Random Numbers in Excel – Project 3 – Region Allocation
Many times, we have to imagine and create the data for various examples. Suppose, we have data for sales and we need to allocate three different regions to every transaction of sale.
Then we could use the RANDBETWEEN function with CHOOSE function.
You can drag the same for remaining cells.
Random Numbers in Excel – Project 4 – Creating Ludo Dice
Using the RANDBETWEEN function, we can also create dice for Ludo. To do the same, we need to use the RANDBETWEEN function in Excel VBA. Please follow the below steps:
- Merge the four cells (B2:C3) using Home Tab-> Alignment Group-> Merge & Center
- Apply the border to the merged cell using shortcut key (ALT+H+B+T) by pressing one key after other.
- Center and middle align the value using Home Tab-> Alignment Group -> ‘Center’ and ‘Middle Align‘ command.
- To create the button, use Developer tab -> Controls Group -> Insert -> ‘Command Button’
- Create the button and choose ‘View Code’ from the ‘Control’ group on ‘Developer’
- After choosing ‘CommandButton1‘ from the drop-down, paste the following code:
RN = (“=RANDBETWEEN(1,6)”)
Cells(2, 2) = RN
Save the file using the .xlsm extension as we have used VBA code in the workbook. After coming to the Excel window, deactivate the ‘Design Mode’.
Now whenever we click on the button, we get a random value between 1 and 6.
This has been a guide to Random Numbers in Excel. Here we discuss how to generate random numbers in excel using RAND() and RANDBETWEEN function along with multiple projects and downloadable excel templates. You may also look at these useful functions in excel