MS Excel: How to use the RAND Function (WS)
This Excel tutorial explains how to use the Excel RAND function with syntax and examples.
Description
The Microsoft Excel RAND function returns a random number that is greater than or equal to 0 and less than 1. The RAND function returns a new random number each time your spreadsheet recalculates.
The RAND function is a built-in function in Excel that is categorized as a Math/Trig Function. It can be used as a worksheet function (WS) in Excel. As a worksheet function, the RAND function can be entered as part of a formula in a cell of a worksheet.
TIP: To create a random number between a range, you might want to try the RANDBETWEEN function.
Syntax
The syntax for the RAND function in Microsoft Excel is:
RAND( )
Parameters or Arguments
There are no parameters or arguments for the RAND function.
Note
To create a random number between two numbers, you can use the following formula:
=RAND()*(b-a)+a
Where a is the smallest number and b is the largest number that you want to generate a random number for. Please note, that this formula will never generate a number at the highest end of the range.
=RAND()*(25-10)+10
The formula above would generate a random number between 10 and 24.9999999.
Returns
The RAND function returns a numeric value that is greater than or equal to 0 and less than 1.
Applies To
- Excel for Office 365, Excel 2019, Excel 2016, Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000
Type of Function
- Worksheet function (WS)
Example (as Worksheet Function)
Let's look at some Excel RAND function examples and explore how to use the RAND function as a worksheet function in Microsoft Excel:
Based on the Excel spreadsheet above, the following RAND examples would return:
=RAND()*(A2-A1)+A1 Result: random number (between 50 and 149.9999999) =RAND()*(A3-A1)+A1 Result: random number (between 50 and 199.9999999) =RAND()*(200-100)+100 Result: random number (between 100 and 199.9999999) =INT(RAND()*(200-100)+100) Result: random number (between 100 and 199, integer value)
Advertisements