Math & trig function

RAND function

Returns a random decimal number from 0 up to (but not including) 1, recalculated every time the sheet changes.

Available in All versions of Excel, Excel for the web, Excel for Mac

In every Excel versionWorks in Google Sheets

Syntax

RAND()

This function takes no arguments.

Returns: A random number ≥ 0 and < 1, evenly distributed.

How RAND works

RAND produces a random number between 0 and 1. On its own that sounds abstract, but it is the basis of many practical tools: shuffling a list, picking a random winner or audit sample, generating test data, and Monte Carlo simulations where you run a model thousands of times with random inputs to see the range of outcomes.

To get a random number in another range, scale it: =min + RAND()*(max-min). For random whole numbers RANDBETWEEN is simpler, and in Microsoft 365 RANDARRAY can produce a whole block of random values at once.

RAND is volatile: it recalculates every time anything in the workbook changes or you press F9, so the values keep moving. To freeze them, copy and Paste Special > Values. The numbers are pseudo-random, good for simulations and sampling but not for cryptography or security.

Examples

1A random number between 0 and 1

A1fx=RAND()
A
10.7351

Result: 0.7351

Shown with 4 decimals. Because the function recalculates whenever the sheet changes, your result will differ; the value shown is only an illustration.

2Random price between 50 and 100

A1fx=50+RAND()*50
A
181.27

Result: 81.27

RAND × 50 gives 0 to 50; adding 50 shifts the range to 50–100 (2 decimals). Because the function recalculates whenever the sheet changes, your result will differ; the value shown is only an illustration.

3Pick a random employee

C2fx=INDEX(A2:A6, INT(RAND()*5)+1)
ABC
1Employee
2AnaChloe
3Ben
4Chloe
5Dev
6Ema

Result: Chloe

INT(RAND()*5)+1 is a random whole number 1–5, and INDEX returns that position from the list. Because the function recalculates whenever the sheet changes, your result will differ; the value shown is only an illustration.

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 15 KB

Common errors and how to fix them

ErrorWhy it happensFix
Values keep changingRAND is volatile and recalculates after every edit.Copy the cells and Paste Special > Values to keep a result; or set calculation to Manual.

Tips

  • Shuffle a list: put =RAND() in a helper column next to it, then sort by that column.
  • Normal-distributed random value: =NORM.INV(RAND(), mean, sd).
  • Press F9 to generate a new set of values.
  • Many RAND cells slow down large workbooks because they recalculate constantly.

Questions

How do I stop RAND from changing?

Copy the cells and use Paste Special > Values. For a single cell, type =RAND() in the formula bar and press F9 before Enter to store the number.

Can RAND return exactly 1?

No. It returns values from 0 up to, but not including, 1.

Google Sheets

RAND also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.

RAND in other languages

In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.

LanguageFunction name
CzechNÁHČÍSLO
DanishSLUMP
DutchASELECT
FinnishSATUNNAISLUKU
FrenchALEA
GermanZUFALLSZAHL
HungarianVÉL
ItalianCASUALE
Norwegian (Bokmål)TILFELDIG
PolishLOS
Portuguese (Brazil)ALEATÓRIO
Portuguese (Portugal)ALEATÓRIO
RussianСЛЧИС
SpanishALEATORIO
SwedishSLUMP
TurkishS_SAYI_ÜRET

Recipes that use RAND