Excel function

RANDfunction

Returns a random number from 0 up to (but not including) 1. It changes on every recalculation.

All versions

What is the RAND function?

=RAND()

RAND returns a random number greater than or equal to 0 and less than 1. It changes to a new value every time the sheet recalculates.

This page shows a different value each time you reload it.

RAND is used for drawing lots, making dummy test data and picking a random sample from a list. In practice the value itself matters less than putting RAND in a helper column and sorting or ranking by it.

Arguments

This function has no arguments. Write it with empty parentheses, like =NAME().

RAND examples

  1. Example 1. A decimal between a and b

    =RAND()*(b-a)+a

    For example, =RAND()*90+10 is at least 10 and less than 100.

  2. Example 2. A random integer

    =INT(RAND()*45)+1

    An integer from 1 to 45, the same as RANDBETWEEN(1,45).

  3. Example 3. Shuffle a list

    =RAND()

    Fill a helper column with RAND and sort by it to shuffle the order.

  4. Example 4. Random order

    =RANK(B2, $B$2:$B$6)

    Put =RAND() in column B and rank it in column C to get the order 1 to 5 with no repeats. The values change on every recalculation, so paste them as values once decided.

    NameColumn B =RAND() (sample)Order
    Liam0.622
    Emma0.155
    Noah0.881
    Olivia0.473
    Ava0.314
  5. Example 5. Split by probability

    =IF(RAND()<0.3, "Win", "Lose")

    About 30% of results are "Win". With few draws it will not be exactly 30%.

Common mistakes

FAQ

Only integers?
Use RANDBETWEEN.
Can I stop it from changing?
Paste it as a value, or set calculation to manual.
Whole numbers with no repeats?
Make a column of RAND and take each value's RANK: you get 1 to n with no repeats.
Several random numbers at once?
In versions with RANDARRAY, =RANDARRAY(5) spills five random numbers.