Excel Functions Tutorials
- Excel Formulas Cheatsheet
- Financial Functions in Excel
- Logical Functions in Excel
- TEXT Functions in Excel
- Concatenate Excel Function
- RIGHT Function in Excel
- LEN in Excel
- LEFT Function in Excel
- Search Function in Excel
- TEXT Function in Excel
- PROPER in Excel
- MID in Excel
- Trim in Excel
- CLEAN Excel Function
- EXACT Excel Function
- REPT Function in Excel
- CODE Excel Function
- FIND Function in Excel
- VALUE Function in Excel
- Char Function In Excel
- Substitute Function in Excel
- Substring in Excel
- Lookup Reference in Excel
- Address Function in Excel
- Choose Function in Excel
- Column Function in Excel
- Columns Function in Excel
- REPLACE Function in Excel
- GetPivotData in Excel
- HLOOKUP in Excel
- Hyperlink Excel Function
- INDIRECT Function in Excel
- LOOKUP Excel Function
- Match Excel Function
- VLOOKUP Excel Function
- INDEX Excel Function
- VLOOKUP vs HLOOKUP
- TRANSPOSE Excel Function
- Row Function in Excel
- OFFSET Excel Function
- VLOOKUP with Multiple Criteria
- IFERROR with VLOOKUP in Excel
- Fixing VLOOKUP Errors
- Alternatives to Vlookup
- Maths Functions in Excel
- POWER Function in Excel
- EVEN Function in Excel
- ODD Function in Excel
- ABS Function in Excel
- SUM Function in Excel
- SUMPRODUCT Function in Excel
- SUBTOTAL Excel Function
- ROUND in Excel
- AGGREGATE Excel Function
- PRODUCT Excel Function
- RAND Excel Function
- LOG Excel Function
- EXPONENTIAL Excel Function
- SUMIF in Excel
- TAN Excel Function
- CEILING Excel Function
- LN Excel Function
- SIGN Excel Function
- COS Excel Function
- FLOOR Function in Excel
- SIN Excel Function
- ROUNDDOWN Excel Function
- ROUNDUP Function in Excel
- COMBIN Excel Function
- INT Excel Function (Integer)
- TANH in Excel
- Date and Time Function in Excel
- Statistical Function in Excel
- AVERAGE Excel Function
- CORREL Excel Function
- COUNT Excel Function
- COUNTIF Excel Function
- FREQUENCY Excel Function
- MAX Excel Function
- MEDIAN Excel Function
- GROWTH Excel Function
- SLOPE Function in Excel
- TREND Function in Excel
- SMALL Function in Excel
- MODE Excel Function
- LARGE Excel Function
- PERCENTILE Excel Function
- LINEST Excel Function
- T-TEST in Excel
- QUARTILE Excel Function
- FORECAST Excel Function
- MIN in Excel
- Standard Deviation in Excel
- COUNTIF with Multiple Criteria
- Mean vs Median
- NORM.S.INV Function in Excel
- NORMDIST in Excel
- Variance vs Standard Deviation
- Information Functions in Excel
- Excel Charts
- Column Chart in excel
- Stacked Column Chart
- Pie Chart in Excel
- Area Chart in Excel
- Stacked Chart in Excel (Column, Bar & 100% Stacked)
- Histogram Excel Chart
- Waterfall Chart in Excel
- Pareto Chart in Excel
- Bubble Chart in Excel
- Gantt Chart in Excel
- Radar Chart in Excel (Spider Chart)
- Clustered Bar Chart in Excel
- Clustered Column Chart in Excel
- Dynamic Chart in Excel
- Excel Tools
- Watch Window in Excel
- List Box in Excel VBA
- Conditional Formatting in Excel
- Data Table in Excel
- Data Validation Excel
- Paste Special in Excel (With Top 10 Shortcuts)
- One Variable Data Table in Excel
- Two-Variable Data Table in Excel
- Scenario Manager in Excel
- Solver in Excel
- Name Range in Excel
- Dynamic Named Range in Excel
- Sort Data in Excel
- Sort by Color in Excel
- Sort by Number in Excel
- Auto Format Excel
- Track Changes in Excel
- Text to Columns in Excel
- Merge Cells in Excel
- Lock Cells in Excel
- Scroll Bars in Excel
- Spell Check in Excel
- Filters in Excel
- Auto Filter In Excel
- Advanced Filter in Excel
- Recording Macros in Excel
- Add-Ins in excel
- Excel Fill Handle
- AutoFill in Excel
- Excel Tables
- Radio Button in Excel
- Combo Box in Excel and VBA
- Checkbox in Excel
- Excel Tips
- How to Unhide Columns in Excel?
- Convert Date to Text in Excel
- Top 20 Keyboard Shortcuts in Excel
- Convert Numbers to Text in Excel
- Show Formula in Excel
- Absolute Reference in Excel
- Relative References in Excel
- Superscript in Excel
- Subscript in Excel
- Formula Errors in Excel
- Convert Text to Numbers in Excel
- Insert Multiple Rows in Excel
- Remove Blank Rows in Excel
- Highlight Every Other Row in Excel
- External Links in Excel
- Insert Hyperlinks in Excel
- Remove Hyperlinks in Excel
- Combine Cells in Excel
- Remove Duplicates in Excel
- Random Numbers in Excel
- Drop Down List in Excel
- Refresh Pivot Table in Excel
- Column Sort in Excel
- Hiding a Column in Excel
- Count Unique Values in Excel
- CAGR Formula in Excel
- Equations in Excel
- How to Delete Pivot Table?
- Excel Subtraction Formula
- Excel Extensions
- Hide Formula in Excel
- Numbering in Excel
- Auto Numbering in Excel
- Row Limit in Excel
- Delete Row Shortcut in Excel
- Arrays in Excel VBA
- Array Formulas in Excel
- Dynamic Tables in Excel
- Convert Columns to Rows in Excel
- Formatting in Excel
- Print Comments in Excel
- Excel vs Google Sheets
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.
You can download this Generating Random Numbers in Excel template here – Generate Random Number Excel Template
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